diff --git a/Main.hs b/Main.hs
--- a/Main.hs
+++ b/Main.hs
@@ -38,9 +38,12 @@
 import Data.List
 import Data.Maybe
 import Data.Monoid
+import Data.Char
 
 import Text.PrettyPrint
 
+import Paths_cabal2arch
+
 import System.Directory
 import System.Environment
 import System.Exit
@@ -104,15 +107,28 @@
    pkgbuild  <- getMD5 pkgbuild'
    let doc       = pkg2doc email pkgbuild
 
+       dir = arch_pkgname pkgbuild
+
    setCurrentDirectory cwd
-   writeFile "PKGBUILD" (render doc)
+   createDirectory dir
+   setCurrentDirectory dir
 
+   writeFile "PKGBUILD" (render doc ++ "\n")
+
    -- print pkgname.install
    case hooks of
         Nothing -> return ()
-        Just i  -> writeFile (install_hook_name (arch_pkgname pkgbuild')) i
+        Just i  -> writeFile (install_hook_name (arch_pkgname pkgbuild)) i
 
+   setCurrentDirectory cwd
 
+   tarred <- readProcess "tar" ["-zcvvf",(dir <.> "tar.gz"), dir] []
+   case tarred of
+        Left (_,s,_)  -> do
+            hPutStrLn stderr s
+            die "Unable to tar package"
+        Right s -> putStrLn s
+
 ------------------------------------------------------------------------
 
 -- | Given an abstract pkgbuild, download the source bundle,
@@ -247,6 +263,7 @@
 pkg2doc email pkg = vcat
  [ text "# Contributor:"
     <+> text email
+ , text "# Package generated by cabal2arch" <+> disp version
  , text "pkgname"
     <=> text (arch_pkgname pkg)
  , text "pkgrel"
@@ -351,7 +368,7 @@
     )
 
   where
-    archName = if isLibrary then "haskell-" ++ name else name
+    archName = map toLower (if isLibrary then "haskell-" ++ name else name)
     name     = pkgName (package cabal)
     vers     = pkgVersion (package cabal)
 
diff --git a/cabal2arch.cabal b/cabal2arch.cabal
--- a/cabal2arch.cabal
+++ b/cabal2arch.cabal
@@ -1,5 +1,5 @@
 name:               cabal2arch
-version:            0.2
+version:            0.2.1
 homepage:           http://code.haskell.org/~dons/code/cabal2arch
 synopsis:           Create Arch Linux packages from Cabal packages
 description:        Create Arch Linux packages from Cabal packages
