diff --git a/epub.cabal b/epub.cabal
--- a/epub.cabal
+++ b/epub.cabal
@@ -1,5 +1,5 @@
 Name:            epub
-Version:         0.0.3
+Version:         0.0.4
 License:         BSD3
 License-File:    LICENSE
 Synopsis:        EPUB E-Book construction support library
@@ -31,7 +31,6 @@
                    xml,
                    Cabal        >= 1.5 && < 1.9
   Hs-Source-Dirs:  src
-  Extensions:      CPP, PatternGuards
   Ghc-Options:      -Wall -fno-warn-orphans
 
   Exposed-modules:
diff --git a/src/Codec/EBook.hs b/src/Codec/EBook.hs
--- a/src/Codec/EBook.hs
+++ b/src/Codec/EBook.hs
@@ -20,6 +20,7 @@
 import qualified Data.ByteString.Lazy as B
 
 -- EPUB media type
+opsMediatype :: String
 opsMediatype = "application/xhtml+xml"
 
 -- Serialize Book to binary EPUB Format
@@ -44,7 +45,7 @@
                        opfFileName = "book.opf"
                        mimeFile   = mimetypeFile
                        contFiles  = bookFiles book
-                       allFiles   = mimeFile:conXMLFile:contFiles ++ opfFiles book opfFileName
+                       allFiles   = conXMLFile:contFiles ++ opfFiles book opfFileName ++ [mimeFile]
                        entries    = map (\(n,c) -> toEntry n t c) allFiles
                        arch       = foldl (\a e -> addEntryToArchive e a) emptyArchive entries
                    in  arch 
diff --git a/src/Codec/EBook/OCF.hs b/src/Codec/EBook/OCF.hs
--- a/src/Codec/EBook/OCF.hs
+++ b/src/Codec/EBook/OCF.hs
@@ -11,10 +11,12 @@
 
 import Codec.EBook.Types
 import Text.XML.Light
-import Codec.Archive.Zip
 import qualified Data.ByteString.Lazy as B
 
+defaultMediatype :: String
 defaultMediatype = "application/oebps-package+xml"
+
+defaultMimetype :: String
 defaultMimetype = "application/epub+zip"
 
 containerXMLFile' :: FilePath -> (FilePath, B.ByteString)
@@ -28,8 +30,9 @@
 	where
 	   contTag = add_attrs contAttrs $ unode "container" rootfilesTag
            contAttrs = [ Attr (unqual "version") "1.0"
-			,Attr (unqual "xmlns")   "urn:oasis:names:tc:opendocument:xmlns:container" ] 
-           rootfilesTag = unode "rootfiles" (rootfileTag p m)
-           rootfileTag p m = add_attrs (rfAttrs p m) $ unode "rootfile" ()
-           rfAttrs p m = [ Attr (unqual "full-path") p
-			  ,Attr (unqual "media-type")  m ] 
+                       , Attr (unqual "xmlns")   "urn:oasis:names:tc:opendocument:xmlns:container" ]
+           rootfilesTag = unode "rootfiles" rootfileTag
+           rootfileTag = add_attrs rfAttrs $ unode "rootfile" ()
+           rfAttrs = [ Attr (unqual "full-path") p
+                     , Attr (unqual "media-type") m
+                     ]
diff --git a/src/Codec/EBook/OPF.hs b/src/Codec/EBook/OPF.hs
--- a/src/Codec/EBook/OPF.hs
+++ b/src/Codec/EBook/OPF.hs
@@ -11,7 +11,10 @@
 import Codec.EBook.Types
 import qualified Data.ByteString.Lazy as B
 
+opfDefaultLang :: String
 opfDefaultLang = "en"
+
+opfDefaultCreator :: String
 opfDefaultCreator = "Unknown"
 
 opfFiles :: Book -> FilePath -> [(FilePath, B.ByteString)] 
@@ -31,11 +34,11 @@
            headT = unode "head" $ map (\(n,v) -> add_attrs [ Attr (unqual "name") n,Attr (unqual "content") v] $ unode "meta" ()) metaVals
            metaVals = [ ("dtb:uid",(bookID o))
                        ,("dtb:depth","1")
-                       ,("dtb:totalPageCount","0") 
+                       ,("dtb:totalPageCount","0")
                        ,("dtb:maxPageNumber","0") ]
            docTitleT = unode "docTitle" $ unode "text" (bookTitle o)
            docAuthorT = unode "docAuthor" $ unode "text" (bookAuthor o)
-           numChapterEnt = zip (chapterItems $ bookItems o) [1..]
+           numChapterEnt = zip (chapterItems $ bookItems o) [(1::Int)..]
            navMapT = unode "navMap" (map navPointT numChapterEnt)
            navPointT (e,i) = add_attrs [ Attr (unqual "class") "chapter" 
                                         ,Attr (unqual "id") (itemID e)
diff --git a/src/xhtml2epub.hs b/src/xhtml2epub.hs
--- a/src/xhtml2epub.hs
+++ b/src/xhtml2epub.hs
@@ -13,17 +13,20 @@
                 bookAuthor = "xhtml2epub",
                 bookTitle = nameOfBook
           }
-          items <- mapM loadItems fileNames
+          items <- mapM loadItems $ zip fileNames [1..]
           let bookFull = foldl' addItem2Book book items
-          let epubFName = nameOfBook++".epub"
+          let epubFName = nameOfBook <.> "epub"
           outdata <- book2Bin' bookFull
           B.writeFile epubFName  outdata
           putStrLn $ epubFName ++ " constructed."
      _ -> error "Usage: xhtml2epub <name of book> <xhtml file1> [<xhtml file2>,...]"
 
-loadItems :: FilePath -> IO BookItem
-loadItems p = do
+-- | Constructs a book item from a given filename and item index. The
+-- index is used to generate a unique item identifier.
+loadItems :: (FilePath,Int) -> IO BookItem
+loadItems (p,i) = do
    c <- B.readFile p
-   return (BookItem ("http://localhost/"++np) np c opsMediatype (Just (ChapterMetadata np))) 
+   return (BookItem iid np c opsMediatype (Just (ChapterMetadata np)))
    where
       np = normalise p
+      iid = takeBaseName p ++ "-" ++ show i
