diff --git a/soxlib.cabal b/soxlib.cabal
--- a/soxlib.cabal
+++ b/soxlib.cabal
@@ -1,5 +1,5 @@
 Name:             soxlib
-Version:          0.0
+Version:          0.0.1
 License:          BSD3
 License-File:     LICENSE
 Author:           Henning Thielemann <haskell@henning-thielemann.de>
@@ -22,7 +22,7 @@
   src/Sound/SoxLib/Template.h
 
 Source-Repository this
-  Tag:         0.0
+  Tag:         0.0.1
   Type:        darcs
   Location:    http://code.haskell.org/~thielema/soxlib/
 
@@ -38,7 +38,7 @@
     -- that's the way to get compatibility between GHC 6.10 and 6.12
     extensible-exceptions >=0.1.1 && <0.2,
     transformers >=0.2 && <0.4,
-    containers >=0.1 && <0.5,
+    containers >=0.1 && <0.6,
     utility-ht >=0.0.5 && <0.1,
     base >=4 && <5
 
diff --git a/src/Sound/SoxLib.hs b/src/Sound/SoxLib.hs
--- a/src/Sound/SoxLib.hs
+++ b/src/Sound/SoxLib.hs
@@ -1,8 +1,8 @@
 module Sound.SoxLib (
    with, formatWith,
-   withRead,  readStorableVector,  readStorableVectorLazy,
-   withWrite, writeStorableVector, writeStorableVectorLazy,
-   seek,
+   openRead,  withRead,  readStorableVector,  readStorableVectorLazy,
+   openWrite, withWrite, writeStorableVector, writeStorableVectorLazy,
+   close, seek,
    FFI.Mode(..), FFI.ReadMode, FFI.WriteMode,
    ReaderInfo(..), defaultReaderInfo,
    WriterInfo(..), defaultWriterInfo,
@@ -30,6 +30,8 @@
 import qualified Data.StorableVector as SV
 
 import qualified Control.Monad.Trans.Cont as MC
+import qualified Control.Monad.Trans.Class as MT
+import Control.Functor.HT (void, )
 import Control.Monad (when, )
 
 import System.IO.Unsafe (unsafeInterleaveIO, )
@@ -66,19 +68,25 @@
    ReaderInfo -> FilePath ->
    (Ptr (FFI.Format FFI.ReadMode) -> IO a) -> IO a
 withRead info path =
-   MC.runContT $ do
+   bracket (openRead info path) close
+
+{- |
+This function will never return a 'nullPtr'.
+Instead it throws a user exception if the file cannot be opened.
+-}
+openRead ::
+   ReaderInfo -> FilePath ->
+   IO (Ptr (FFI.Format FFI.ReadMode))
+openRead info path =
+   flip MC.runContT return $ do
       si  <- withMaybe U.with $ readerSignalInfo info
       enc <- withMaybe U.with $ readerEncodingInfo info
       cft <- withMaybe CStr.withCString $
                  fmap FFI.unFileType $ readerFileType info
       cpath <- MC.ContT $ CStr.withCString path
-      MC.ContT $
-         bracket
-            (do fmt <- FFI.openRead cpath si enc cft
-                if fmt==nullPtr
-                  then throwDoesNotExist "SoxLib.withRead" path
-                  else return fmt)
-            FFI.close
+      MT.lift $
+         checkHandle "SoxLib.openRead" path =<<
+         FFI.openRead cpath si enc cft
 
 
 data WriterInfo =
@@ -95,26 +103,44 @@
    WriterInfo -> FilePath ->
    (Ptr (FFI.Format FFI.WriteMode) -> IO a) -> IO a
 withWrite info path =
-   MC.runContT $ do
+   bracket (openWrite info path) close
+
+{- |
+This function will never return a 'nullPtr'.
+Instead it throws a user exception if the file cannot be opened.
+-}
+openWrite ::
+   WriterInfo -> FilePath ->
+   IO (Ptr (FFI.Format FFI.WriteMode))
+openWrite info path =
+   flip MC.runContT return $ do
       si  <- withMaybe U.with $ writerSignalInfo info
       enc <- withMaybe U.with $ writerEncodingInfo info
       cft <- withMaybe CStr.withCString $
                  fmap FFI.unFileType $ writerFileType info
       cpath <- MC.ContT $ CStr.withCString path
-      MC.ContT $
-         bracket
-            (do fmt <- FFI.openWrite cpath si enc cft nullPtr nullFunPtr
-                if fmt==nullPtr
-                  then throwDoesNotExist "SoxLib.withWrite" path
-                  else return fmt)
-            FFI.close
+      MT.lift $
+         checkHandle "SoxLib.openWrite" path =<<
+         FFI.openWrite cpath si enc cft nullPtr nullFunPtr
 
 
+checkHandle :: String -> FilePath -> Ptr a -> IO (Ptr a)
+checkHandle name path fmt =
+   if fmt==nullPtr
+     then throwDoesNotExist name path
+     else return fmt
+
 throwDoesNotExist :: String -> FilePath -> IO a
 throwDoesNotExist name path =
    ioError $
       mkIOError doesNotExistErrorType
          name Nothing (Just path)
+
+
+
+close :: FFI.Mode mode => Ptr (FFI.Format mode) -> IO ()
+close = void . FFI.close
+
 
 {- |
 Multi-channel data is interleaved.
