diff --git a/System/Hardware/Serialport.hs b/System/Hardware/Serialport.hs
--- a/System/Hardware/Serialport.hs
+++ b/System/Hardware/Serialport.hs
@@ -28,11 +28,13 @@
   -- ** Device
   ,openSerial
   ,closeSerial
+  ,withSerial
   -- ** Sending & receiving
   ,sendChar
   ,sendString
   ,recvChar
   ,recvString
+  ,flush
   -- ** Line control
   ,setDTR
   ,setRTS
@@ -44,3 +46,12 @@
 import System.Hardware.Serialport.Posix
 #endif
 import System.Hardware.Serialport.Types
+
+
+-- |Safer device function, so you don't forget to close the device
+withSerial :: String -> SerialPortSettings -> ( SerialPort -> IO a ) -> IO a
+withSerial dev settings f = do
+  s <- openSerial dev settings
+  res <- f s
+  closeSerial s
+  return res
diff --git a/System/Hardware/Serialport/Posix.hsc b/System/Hardware/Serialport/Posix.hsc
--- a/System/Hardware/Serialport/Posix.hsc
+++ b/System/Hardware/Serialport/Posix.hsc
@@ -51,6 +51,12 @@
   fdWrite fd' s >> return ()
 
 
+-- |Flush buffers
+flush :: SerialPort -> IO ()
+flush (SerialPort fd' _) =
+  discardData fd' BothQueues
+
+
 -- |Close the serial port
 closeSerial :: SerialPort -> IO ()
 closeSerial (SerialPort fd' _ ) =
diff --git a/System/Hardware/Serialport/Windows.hs b/System/Hardware/Serialport/Windows.hs
--- a/System/Hardware/Serialport/Windows.hs
+++ b/System/Hardware/Serialport/Windows.hs
@@ -75,6 +75,12 @@
     overlapped = Nothing
 
 
+-- |Flush buffers
+flush :: SerialPort -> IO ()
+flush (SerialPort h _) =
+  flushFileBuffers h
+
+
 -- |Close the serial port
 closeSerial :: SerialPort -> IO ()
 closeSerial (SerialPort h _) =
diff --git a/serialport.cabal b/serialport.cabal
--- a/serialport.cabal
+++ b/serialport.cabal
@@ -1,10 +1,10 @@
 Name:           serialport
-Version:        0.4.1
+Version:        0.4.2
 Cabal-Version:  >= 1.6
 Build-Type:     Custom
 license:        BSD3
 license-file:   LICENSE
-copyright:      (c) 2009 Joris Putcuyps
+copyright:      (c) 2009-2011 Joris Putcuyps
 author:         Joris Putcuyps
 maintainer:     Joris.Putcuyps@gmail.com
 homepage:       https://github.com/jputcu/serialport
@@ -20,7 +20,7 @@
 Library
   Exposed-Modules:    System.Hardware.Serialport
   Other-Modules:      System.Hardware.Serialport.Types
-  Build-Depends:      base >= 4, base < 5
+  Build-Depends:      base >= 4 && < 5
   ghc-options:        -Wall
 
   if !os(windows)
