diff --git a/hsb2hs.cabal b/hsb2hs.cabal
--- a/hsb2hs.cabal
+++ b/hsb2hs.cabal
@@ -1,5 +1,5 @@
 Name:         hsb2hs
-Version:      0.1
+Version:      0.2
 Synopsis:     Preprocesses a file, adding blobs from files as string literals.
 Description:
     hsb2hs is a preprocessor that allows you to include the contents of
@@ -22,4 +22,4 @@
     Main-is: hsb2hs.hs
     Ghc-Options: -Wall
     Build-depends: base >= 4 && < 5, containers, bytestring, directory,
-                   filepath, preprocessor-tools > 0.1 && < 0.2
+                   filepath, preprocessor-tools > 1.0
diff --git a/hsb2hs.hs b/hsb2hs.hs
--- a/hsb2hs.hs
+++ b/hsb2hs.hs
@@ -1,7 +1,6 @@
 module Main
 where
 import Language.Haskell.Preprocessor
-import System.IO.Unsafe (unsafePerformIO)
 
 import qualified Data.ByteString as B
 import System.Directory
@@ -21,25 +20,32 @@
     transformer = processBlobs
 }
 
-processBlobs :: [Ast] -> [Ast]
-processBlobs [] = []
+processBlobs :: [Ast] -> IO [Ast]
+
+processBlobs [] = return []
+
 processBlobs (Single (Token Operator _ l "%") :
               Single (Token Variable _ _ kw) :
               Single (Token StringLit _ _ lit) :
-              xs) | kw == "blobs" || kw == "blob" =
-  (Single (Token StringLit [] l (getLiteral $ stripQuotes lit))) :
-     processBlobs xs
-   where stripQuotes = reverse . stripLeadingQuote . reverse . stripLeadingQuote
-         stripLeadingQuote ('"':ys) = ys
-         stripLeadingQuote ys = ys
-         getLiteral f = unsafePerformIO $ if kw == "blob"
-                                             then show `fmap` B.readFile f
-                                             else show `fmap` fileList' f ""
-processBlobs (x:xs) =
-  (case x of
-      Single tok -> Single tok
-      Block i l b r n -> Block i l (processBlobs b) r n
-      Empty      -> Empty) : processBlobs xs
+              xs) | kw == "blobs" || kw == "blob" = do
+  let f = stripQuotes lit
+  t <- if kw == "blob"
+          then show `fmap` B.readFile f
+          else show `fmap` fileList' f ""
+  rest <- processBlobs xs
+  return $ (Single (Token StringLit [] l t)) : rest
+ where stripQuotes = reverse . stripLeadingQuote . reverse . stripLeadingQuote
+       stripLeadingQuote ('"':ys) = ys
+       stripLeadingQuote ys = ys
+
+processBlobs (Block i l b r n : xs) = do
+  bs <- processBlobs b
+  rest <- processBlobs xs
+  return $ Block i l bs r n : rest
+
+processBlobs (x : xs) = do
+  rest <- processBlobs xs
+  return $ x : rest
 
 -- fileList' is taken from Michael Snoyman's file-embed
 fileList' :: FilePath -> FilePath -> IO [(FilePath, B.ByteString)]
