diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,13 @@
+module Main (main) where
+
+import System.Cmd (system)
+
+import Distribution.Simple (defaultMainWithHooks, runTests, simpleUserHooks)
+
+main :: IO ()
+main =
+    defaultMainWithHooks $
+      simpleUserHooks
+        { runTests = \_ _ _ _ ->
+            system "runhaskell -i./src -Wall -XTemplateHaskell src/test.hs" >> return ()
+        }
diff --git a/Setup.lhs b/Setup.lhs
deleted file mode 100644
--- a/Setup.lhs
+++ /dev/null
@@ -1,4 +0,0 @@
-#! /usr/bin/env runhaskell
-
-> import Distribution.Simple
-> main = defaultMain
diff --git a/hslogger-template.cabal b/hslogger-template.cabal
--- a/hslogger-template.cabal
+++ b/hslogger-template.cabal
@@ -1,9 +1,9 @@
 name:     hslogger-template
-version:  0.1
+version:  0.2
 synopsis: Automatic generation of hslogger functions
 description:
-    A function for generating hslogger functions automatically using Template
-    Haskell.
+    Library for generating hslogger functions using Template Haskell.
+homepage: http://github.com/bsl/hslogger-template
 
 license:    PublicDomain
 author:     Brian Lewis <brian@lorf.org>, Ian Taylor <ian@lorf.org>
@@ -11,7 +11,7 @@
 category:   Interfaces
 
 cabal-version: >= 1.6
-build-type:    Simple
+build-type:    Custom
 
 library
   exposed-modules: System.Log.Logger.TH
@@ -20,4 +20,4 @@
   hs-source-dirs:  src
   ghc-options:     -Wall
   if impl(ghc >= 6.8)
-    ghc-options: -fwarn-tabs
+    ghc-options:   -fwarn-tabs
diff --git a/src/System/Log/Logger/TH.hs b/src/System/Log/Logger/TH.hs
--- a/src/System/Log/Logger/TH.hs
+++ b/src/System/Log/Logger/TH.hs
@@ -1,12 +1,12 @@
--- | This module provides a function that generates hslogger functions
--- automatically using Template Haskell.
+-- | This module provides functions that generate hslogger functions using
+-- Template Haskell.
 module System.Log.Logger.TH (deriveLoggers) where
 
 import qualified Language.Haskell.TH as TH
 
 import qualified System.Log.Logger as HSL
 
--- | Generate hslogger functions for given priorities.
+-- | Generate hslogger functions for a list of priorities.
 --
 -- Example usage:
 --
@@ -19,25 +19,31 @@
 --
 -- Used this way, @deriveLoggers@ would generate the following functions:
 --
--- > info :: String -> IO ()
--- > info s = HSL.infoM "Foo.Bar" ((++) "Foo.Bar: " s)
+-- > infoM :: String -> IO ()
+-- > infoM s = HSL.infoM "Foo.Bar" ((++) "Foo.Bar: " s)
 -- >
--- > debug :: String -> IO ()
--- > debug s = HSL.debugM "Foo.Bar" ((++) "Foo.Bar: " s)
+-- > debugM :: String -> IO ()
+-- > debugM s = HSL.debugM "Foo.Bar" ((++) "Foo.Bar: " s)
 --
 -- The other hslogger priorities follow the same pattern.
 --
 -- So
 --
--- > info "hi there"
+-- > infoM "hi there"
 --
 -- would generate the INFO-level log event
 --
 -- > Foo.Bar: hi there
 --
--- Note: "System.Log.Logger" must be imported qualified, and the qualifier must
--- match the qualifier given to @deriveLoggers@.
+-- Notes:
 --
+--   * "System.Log.Logger" must be imported qualified, and the qualifier must
+--   match the qualifier given to @deriveLoggers@.
+--
+--   * Don't forget to enable Template Haskell preprocessing: specify the
+--   pragma @LANGUAGE TemplateHaskell@ at the top of your source file or
+--   @extensions: TemplateHaskell@ in your cabal file, etc.
+--
 deriveLoggers
   :: String          -- ^ Must match qualifier on import of "System.Log.Logger".
   -> [HSL.Priority]  -- ^ List of priorities for which to generate logging functions.
@@ -54,36 +60,38 @@
     code = do
         sig  <- TH.sigD th_f [t| String -> IO () |]
         body <- TH.funD th_f
-                  [ TH.clause [TH.varP th_s]
-                    (TH.normalB
-                      (TH.appE
-                        (TH.appE
-                          (TH.varE th_h)
-                          (TH.stringE moduleName)
-                        )
+                  [ TH.clause
+                      [TH.varP th_s]
+                      (TH.normalB
                         (TH.appE
                           (TH.appE
-                            (TH.varE '(++))
-                            (TH.litE (TH.stringL (moduleName ++ ": ")))
+                            (TH.varE th_h)
+                            (TH.stringE moduleName)
                           )
-                          (TH.varE th_s)
+                          (TH.appE
+                            (TH.appE
+                              (TH.varE '(++))
+                              (TH.stringE prefix)
+                            )
+                            (TH.varE th_s)
+                          )
                         )
                       )
-                    )
-                    []
+                      []
                   ]
         return [sig, body]
       where
-        th_f = TH.mkName functionName
-        th_h = TH.mkName (concat [qualifier, ".", functionName, "M"])
         th_s = TH.mkName "s"
+        th_f = TH.mkName functionName
+        th_h = TH.mkName (qualifier ++ "." ++ functionName)
+        prefix = moduleName ++ ": "
         functionName =
           case priority of
-            HSL.DEBUG     -> "debug"
-            HSL.INFO      -> "info"
-            HSL.NOTICE    -> "notice"
-            HSL.WARNING   -> "warning"
-            HSL.ERROR     -> "error"
-            HSL.CRITICAL  -> "critical"
-            HSL.ALERT     -> "alert"
-            HSL.EMERGENCY -> "emergency"
+            HSL.DEBUG     -> "debugM"
+            HSL.INFO      -> "infoM"
+            HSL.NOTICE    -> "noticeM"
+            HSL.WARNING   -> "warningM"
+            HSL.ERROR     -> "errorM"
+            HSL.CRITICAL  -> "criticalM"
+            HSL.ALERT     -> "alertM"
+            HSL.EMERGENCY -> "emergencyM"
