diff --git a/shake-ext.cabal b/shake-ext.cabal
--- a/shake-ext.cabal
+++ b/shake-ext.cabal
@@ -1,5 +1,5 @@
 name:                shake-ext
-version:             1.2.0.3
+version:             1.3.0.0
 synopsis:            Helper functions for linting with shake 
 description:         This package provides several linters out of the box, as well as functionality for building ATS source files with [shake](http://shakebuild.com/).
 homepage:            https://hub.darcs.net/vmchale/shake-ext
diff --git a/src/Development/Shake/ATS.hs b/src/Development/Shake/ATS.hs
--- a/src/Development/Shake/ATS.hs
+++ b/src/Development/Shake/ATS.hs
@@ -7,7 +7,7 @@
                              , cgenPretty
                              , cleanATS
                              , atsBin
-                             , lexAts
+                             , atsLex
                              -- * Actions
                              , patsHome
                              -- Types
@@ -36,7 +36,6 @@
 patsHome v = fromMaybe "/usr/local/lib/ats2-postiats-0.3.9" <$> mh
     where mh = fmap (++ ("/.atspkg/" ++ show v ++ "/")) <$> getEnv "HOME"
 
--- TODO install the whole compiler?
 atsCommand :: CmdResult r => Version -> Version -> String -> String -> Action r
 atsCommand v v' sourceFile out = do
     h <- patsHome v'
@@ -49,6 +48,8 @@
 gcFlag False = "-DATS_MEMALLOC_LIBC"
 gcFlag True  = "-DATS_MEMALLOC_GCBDW"
 
+-- Copy source files to the appropriate place. This is necessary because
+-- @#include@s in ATS are fucked up.
 copySources :: Version -> Version -> [FilePath] -> Action ()
 copySources v v' sources =
     forM_ sources $ \dep -> do
@@ -58,7 +59,13 @@
         liftIO $ copyFile dep (home ++ "/" ++ dep)
 
 -- TODO musl?
-atsBin :: Version -> Version -> Bool -> [String] -> String -> String -> Rules ()
+atsBin :: Version -- ^ Library version
+       -> Version -- ^ Compiler version
+       -> Bool -- ^ Whether to use the garbage collector
+       -> [String] -- ^ A list of libraries against which to link
+       -> String -- ^ Source file
+       -> String -- ^ Binary target
+       -> Rules ()
 atsBin v v' gc libs sourceFile out =
 
     out %> \_ -> do
@@ -75,9 +82,9 @@
             (home ++ "/bin/patscc")
             ([sourceFile, "-atsccomp", "gcc -flto -I" ++ h ++ "/ccomp/runtime/ -I" ++ h, gcFlag gc, "-o", out, "-cleanaft", "-O2", "-mtune=native", "-flto"] <> toLibs libs)
 
-    -- | Build a @.lats@ file.
-lexAts :: Rules ()
-lexAts = priority 0.5 $
+-- | Build a @.lats@ file.
+atsLex :: Rules ()
+atsLex =
     "*.dats" %> \out -> do
         lats <- liftIO $ readFile (out -<.> "lats")
         (Stdout contents) <- command [Stdin lats] "atslex" []
@@ -87,9 +94,7 @@
 cleanATS =
 
     "clean" ~> do
-        cmd_ ["sn", "c"]
         removeFilesAfter "." ["//*.c", "//tags"]
-        removeFilesAfter ".shake" ["//*"]
         removeFilesAfter ".atspkg" ["//*"]
         removeFilesAfter "ats-deps" ["//*"]
 
@@ -101,13 +106,16 @@
 
 -- | This provides rules for generating C code from ATS source files in the
 -- @ats-src@ directory.
-cgen :: Version -> FilePath -> Rules ()
-cgen v dir =
+cgen :: Version -- ^ Library version
+     -> Version -- ^ Compiler version
+     -> FilePath -- ^ Directory for the generated C code
+     -> Rules ()
+cgen v v' dir =
 
     "//*.c" %> \out -> do
         let sourceFile = dir ++ "/" ++ (dropDirectory1 out -<.> "dats")
-        handleSource v v sourceFile
-        atsCommand v v sourceFile out
+        handleSource v v' sourceFile
+        atsCommand v v' sourceFile out
 
 trim :: String -> String
 trim = init . drop 1
@@ -122,14 +130,17 @@
     pure $ (p:deps) ++ deps'
 
 -- | This uses @pats-filter@ to prettify the errors.
-cgenPretty :: Version -> FilePath -> Rules ()
-cgenPretty v dir =
+cgenPretty :: Version -- ^ Library version
+           -> Version -- ^ Compiler version
+           -> FilePath
+           -> Rules ()
+cgenPretty v v' dir =
 
     "//*.c" %> \out -> do
 
         let sourceFile = dir ++ "/" ++ (dropDirectory1 out -<.> "dats")
-        handleSource v v sourceFile
-        (Exit c, Stderr err) :: (Exit, Stderr String) <- atsCommand v v sourceFile out
+        handleSource v v' sourceFile
+        (Exit c, Stderr err) :: (Exit, Stderr String) <- atsCommand v v' sourceFile out
         cmd_ [Stdin err] Shell "pats-filter"
         if c /= ExitSuccess
             then error "patscc failure"
