diff --git a/multifile.cabal b/multifile.cabal
--- a/multifile.cabal
+++ b/multifile.cabal
@@ -10,7 +10,7 @@
 -- PVP summary:      +-+------- breaking API changes
 --                   | | +----- non-breaking API additions
 --                   | | | +--- code changes with no API change
-version:             0.1.0.2
+version:             0.1.0.3
 
 -- A short (one-line) description of the package.
 synopsis: create many files from one
@@ -60,7 +60,7 @@
   -- other-extensions:    
   
   -- Other library packages from which modules are imported.
-  build-depends:       base >=4.9 && <4.10 , HaXml < 10000 , directory < 10000, optparse-applicative < 10000 , pretty <10000
+  build-depends:       base >=4.9 && <4.10 , HaXml < 10000 , directory >= 1.2.7 , pretty <10000,transformers <10000
   
   -- Directories containing source files.
   hs-source-dirs:      src
diff --git a/src/Main.hs b/src/Main.hs
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -3,6 +3,7 @@
 import System.Environment
 import System.IO
 import Text.XML.HaXml
+import Text.XML.HaXml.Escape
 import Text.XML.HaXml.XmlContent.Haskell
  
 import Extsubset
@@ -10,20 +11,73 @@
 import Control.Monad
 import System.Directory
 
-import Options.Applicative
-
 import Text.PrettyPrint
+import Data.Maybe
+import Data.Either
 
-create' xs = do
- files <- forM xs $ \filePath -> do
-   content <- readFile filePath
-   return ( File (File_Attrs filePath) content )
- return (render $ htmlprint $ toContents $ Multifile files)
+import Control.Monad.Trans.Except
+import Control.Monad.Trans.Class 
+import Data.Char
 
-create xs = create' xs >>= putStr
+isRegularPath :: FilePath -> Bool 
+isRegularPath f = f /= "." && f /= ".."
 
- -- data Args = Args {
+isRegularDirectory f = fmap (== isRegularPath f) (doesDirectoryExist f) 
 
+doesPathExist' f = liftM2 (||) (isRegularDirectory f) (doesFileExist f)
+
+create'' dirStack xs = do
+ files <- forM (filter isRegularPath xs) $ \filePath -> do
+   let filePath' = dirStack++filePath
+   properFile <- lift $ doesFileExist filePath'
+   properDir <- lift $ doesDirectoryExist filePath'
+   if properDir then do
+     filePaths <- lift $ listDirectory filePath'
+     files' <- create'' (dirStack ++ ((filter (/='/') filePath) ++ "/")) filePaths
+     return files'
+   else if properFile then do
+     content <- lift $ readFile filePath'
+     return [File (File_Attrs filePath') content ]
+   else  
+     throwE filePath'
+ return (concat files)
+
+create' files =runExceptT $ do 
+   files' <- create'' [] files
+   return $ (render $ htmlprint $ map myFun $ toContents $ Multifile files')
+
+
+s = xmlEscapeContent  stdXmlEscaper 
+
+create xs = create' xs >>= \x -> case x of 
+   (Left x) -> putStrLn ("unknown file "++x)
+   (Right x) -> putStr x
+
+cdatafy x = "<![CDATA[" ++ x ++ "]]>"
+
+
+g = 
+ (\ ch ->
+      let
+         i = ord ch
+      in
+         i < 10 || (10<i && i<32) || i >= 127 ||
+            case ch of
+               '\'' -> True
+               '\"' -> True
+               '&' -> True
+               '<' -> True
+               '>' -> True
+               _ -> False
+      )
+
+myFun (CString a b c) | any g b =  CString a (cdatafy b) c
+                      | otherwise =  CString a b c
+myFun (CElem e i) = CElem (myFun' e) i
+myFun  x = x
+
+myFun' (Elem a b cs) = Elem a b (map myFun cs)
+
 dir x = getDirectoryContents x >>= create 
 
 main :: IO ()
@@ -38,7 +92,6 @@
  where 
  z ("-create":xs) = create xs
  z ("-c":xs) = create xs
- z ("-dir":x:[]) = dir x
  z _             = putStr "unknown usage"
 
 processFiles (Multifile xs) = mapM_ processFile xs
