diff --git a/http-pony-serve-wai.cabal b/http-pony-serve-wai.cabal
--- a/http-pony-serve-wai.cabal
+++ b/http-pony-serve-wai.cabal
@@ -2,7 +2,7 @@
 -- documentation, see http://haskell.org/cabal/users-guide/
 
 name:                http-pony-serve-wai
-version:             0.1.0.3
+version:             0.1.0.4
 synopsis:            Serve a WAI application with http-pony
 -- description:         
 license:             BSD3
@@ -19,30 +19,30 @@
 
 library
   exposed-modules:     Network.HTTP.Pony.Serve.Wai
-                     , Network.HTTP.Pony.Serve.Wai.Parser
                      , Network.HTTP.Pony.Serve.Wai.Helper
                      , Network.HTTP.Pony.Serve.Wai.Type
   -- other-modules:       
   -- other-extensions:    OverloadedStrings
   build-depends:       base >=4.9 && <4.10
                      , attoparsec >=0.13
-                     , blaze-builder
+                     , blaze-builder >= 0.4.0.2
                      , bytestring >=0.10
-                     , case-insensitive
-                     , http-types
-                     , pipes >=4.1
-                     , pipes-bytestring
-                     , wai
+                     , case-insensitive >= 1.2.0.7
                      , http-pony-transformer-http >= 0.1.0.0
                      , http-pony-transformer-startline>= 0.1.0.0
+                     , http-types >= 0.9.1
+                     , pipes >=4.1
+                     , pipes-bytestring >= 2.1.3
+                     , pipes-safe >= 2.2.4
+                     , wai >= 3.2.1.1
+                     , transformers >= 0.5.2
 
                      -- testing
-                     -- , pipes-safe
-                     -- , pipes-network
-                     -- , http-pony-transformer-case-insensitive >= 0.1.0.1
                      -- , foreign-store
-                     -- , http-pony
+                     -- , http-pony >= 0.1.0.3
+                     -- , http-pony-transformer-case-insensitive >= 0.1.0.1
                      -- , lens
+                     -- , pipes-network
 
   hs-source-dirs:      src
                        -- test
diff --git a/src/Network/HTTP/Pony/Serve/Wai.hs b/src/Network/HTTP/Pony/Serve/Wai.hs
--- a/src/Network/HTTP/Pony/Serve/Wai.hs
+++ b/src/Network/HTTP/Pony/Serve/Wai.hs
@@ -1,10 +1,12 @@
 -- | Wai
 
+{-# LANGUAGE Rank2Types #-}
 {-# LANGUAGE OverloadedStrings #-}
 
 module Network.HTTP.Pony.Serve.Wai where
 
 import           Blaze.ByteString.Builder (toLazyByteString)
+import           Control.Monad.Trans.Class (lift)
 import           Data.Attoparsec.ByteString (parse, eitherResult)
 import           Data.ByteString (ByteString)
 import qualified Data.ByteString.Char8 as B
@@ -16,18 +18,18 @@
                                       , ResponseReceived(ResponseReceived))
 import           Pipes (next)
 import           Pipes.ByteString (fromLazy)
+import           Pipes.Safe (SafeT, runSafeT, MonadSafe)
 
 import           Network.HTTP.Pony.Serve.Wai.Helper ((-))
-import           Network.HTTP.Pony.Serve.Wai.Parser (parseRequestURITokens)
 import           Network.HTTP.Pony.Serve.Wai.Type (Request, Response, App)
 import           Prelude hiding ((-))
 
 
-parseRequest :: Request -> IO Wai.Request
+parseRequest :: Request (SafeT IO) -> (SafeT IO) Wai.Request
 parseRequest (((method, uri, version), headers), body) = do
-  bodyRef <- newIORef (Just body)
+  bodyRef <- lift - newIORef (Just body)
 
-  let (rawPathInfo, rawQueryString) = parseRequestURITokens uri
+  let (rawPathInfo, rawQueryString) = B.break (== '?') uri
       (pathInfo, queryString) = HTTP.decodePath uri
 
   pure Wai.defaultRequest
@@ -43,7 +45,7 @@
         bodyC <- readIORef bodyRef
         case bodyC of
           Just _body -> do
-            r <- next _body
+            r <- runSafeT - next _body
             case r of
               Right (x, bodyC) -> do
                 writeIORef bodyRef (Just bodyC)
@@ -62,14 +64,15 @@
 fromWAI :: ( Wai.Request
                 -> (Wai.Response -> IO ResponseReceived)
                 -> IO ResponseReceived
-              ) -> App
+              ) -> App (SafeT IO)
 fromWAI app r = do
   waiRequest <- parseRequest r
 
+
   let waiC :: (Wai.Response -> IO ResponseReceived) -> IO ResponseReceived
       waiC = app waiRequest
 
-  responseRef <- newIORef Nothing
+  responseRef <- lift - newIORef Nothing
 
   let version = Wai.httpVersion waiRequest
 
@@ -88,9 +91,9 @@
           _ -> do
             pure ResponseReceived
 
-  waiC - callback
+  lift - waiC - callback
 
-  maybeResponse <- readIORef responseRef
+  maybeResponse <- lift - readIORef responseRef
 
   case maybeResponse of
     Just response -> do
diff --git a/src/Network/HTTP/Pony/Serve/Wai/Parser.hs b/src/Network/HTTP/Pony/Serve/Wai/Parser.hs
deleted file mode 100644
--- a/src/Network/HTTP/Pony/Serve/Wai/Parser.hs
+++ /dev/null
@@ -1,24 +0,0 @@
--- | Parser
-
-{-# LANGUAGE OverloadedStrings #-}
-
-module Network.HTTP.Pony.Serve.Wai.Parser where
-
-import qualified Data.Attoparsec.ByteString.Char8 as Char
-import           Data.ByteString.Char8 (ByteString)
-import qualified Data.ByteString.Char8 as B
-
--- requestURITokens :: Parser (ByteString, ByteString)
--- requestURITokens = do
---   ( (,) <$> Char.takeTill (== '?')
---         <*> (Char.char '?' >> takeByteString)
---     )
-
---   <|>
-
---   ( (,) <$> takeByteString
---         <*> pure mempty
---     )
-
-parseRequestURITokens :: ByteString -> (ByteString, ByteString)
-parseRequestURITokens = B.break (== '?')
diff --git a/src/Network/HTTP/Pony/Serve/Wai/Type.hs b/src/Network/HTTP/Pony/Serve/Wai/Type.hs
--- a/src/Network/HTTP/Pony/Serve/Wai/Type.hs
+++ b/src/Network/HTTP/Pony/Serve/Wai/Type.hs
@@ -1,14 +1,15 @@
 module Network.HTTP.Pony.Serve.Wai.Type where
 
 
-import Data.ByteString (ByteString)
-import Data.CaseInsensitive (CI)
+import           Data.ByteString (ByteString)
+import           Data.CaseInsensitive (CI)
 import qualified Network.HTTP.Pony.Transformer.HTTP.Type as HTTP
 import qualified Network.HTTP.Pony.Transformer.StartLine.Type as StartLine
+import           Pipes.Safe (SafeT)
 
 type MessageType a = (a, [(CI ByteString, ByteString)])
 
-type Request = HTTP.Request (MessageType StartLine.RequestLine) ByteString IO ()
-type Response = HTTP.Response (MessageType StartLine.ResponseLine) ByteString IO ()
+type Request m = HTTP.Request (MessageType StartLine.RequestLine) ByteString m ()
+type Response m = HTTP.Response (MessageType StartLine.ResponseLine) ByteString m ()
 
-type App = Request -> IO Response
+type App m = Request m -> m (Response m)
