diff --git a/config.json b/config.json
new file mode 100644
--- /dev/null
+++ b/config.json
@@ -0,0 +1,3 @@
+{
+    sourceFolders: ["src", "test/", "test/example"]
+}
diff --git a/doctest-discover.cabal b/doctest-discover.cabal
--- a/doctest-discover.cabal
+++ b/doctest-discover.cabal
@@ -1,5 +1,5 @@
 name:                doctest-discover
-version:             0.1.0.9
+version:             0.2.0.0
 synopsis:            Easy way to run doctests via cabal
 description:         doctest-discover provides an easy way to run doctests via cabal
 license:             PublicDomain
@@ -10,6 +10,7 @@
 category:            Testing
 build-type:          Simple
 cabal-version:       >=1.10
+extra-source-files:  config.json
 
 source-repository head
   type: git
diff --git a/src/Main.hs b/src/Main.hs
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -3,8 +3,8 @@
 import System.Environment
 import Control.Applicative 
 import Control.Monad
-import Data.Maybe (fromMaybe)
-import Data.List (sort)
+import Data.Maybe (fromMaybe, listToMaybe)
+import Data.List (sort, isPrefixOf)
 import Runner
 import Config
 import System.Directory
@@ -12,16 +12,30 @@
 
 main :: IO ()
 main = do
-    (src : _ : dst : args) <- getArgs
-    let configFileContents = case args of
-                              (configFile : _) -> readFile configFile
-                              _ -> return ""
-    customConfiguration <- config <$> configFileContents
-    let sources = fromMaybe ["src"] $ customConfiguration >>= sourceFolders
-    files <- sequence $ map getAbsDirectoryContents sources
-    let testDriverFileContents = driver (concat files) customConfiguration
+    (_ : _ : dst : args) <- getArgs
+    maybeConfiguration <- readConfig (listToMaybe args)
+    testDriverFileContents <- buildDriverFileContents maybeConfiguration
     writeFile dst testDriverFileContents
 
+-- | Obtain configuration, given a configuration file.
+--
+-- >>> readConfig (Just "test/test-config.json")
+-- Just (Config {ignore = ..., sourceFolders = ..., doctestOptions = ...})
+
+readConfig :: Maybe FilePath -> IO (Maybe Config)
+readConfig x = config <$> configFileContents
+  where
+    configFileContents :: IO String
+    configFileContents = fromMaybe (return "") (readFile <$> x)
+
+-- | Given a configuration, build a driver.
+
+buildDriverFileContents :: Maybe Config -> IO String
+buildDriverFileContents x = do
+    let sources = fromMaybe ["src"] $ x >>= sourceFolders
+    files <- sequence $ map getAbsDirectoryContents sources
+    return $ driver (concat files) x
+
 -- | Recursively get absolute directory contents
 --
 -- >>> :m +Data.List
@@ -29,13 +43,17 @@
 -- >>> map (stripPrefix prefix) <$> getAbsDirectoryContents "test/example"
 -- [Just "/test/example/Foo.hs",Just "/test/example/Foo/Bar.hs"]
 --
+-- >>> map (stripPrefix prefix) <$> getAbsDirectoryContents "test/example-with-dotfiles"
+-- [Just "/test/example-with-dotfiles/Baz.hs"]
+
 getAbsDirectoryContents :: FilePath -> IO [FilePath]
 getAbsDirectoryContents dir = do
-    paths <- getDirectoryContents dir
-    paths' <- forM (filter (`notElem` [".", ".."]) paths) $ \path -> do
+    paths <- filter notDotfile <$> getDirectoryContents dir
+    paths' <- forM (filter notDotfile paths) $ \path -> do
         canonicalized <- canonicalizePath $ dir </> path
         isDir <- doesDirectoryExist canonicalized
         if isDir
             then getAbsDirectoryContents canonicalized
             else return [canonicalized]
     return $ sort $ concat paths'
+  where notDotfile = not . ("." `isPrefixOf`)
diff --git a/src/Runner.hs b/src/Runner.hs
--- a/src/Runner.hs
+++ b/src/Runner.hs
@@ -12,13 +12,31 @@
 
 -- | Generates doctest driver
 --
--- >>> let expected = unlines ["module Main where", "import Test.DocTest", "main :: IO ()", "main = doctest [\"-isrc\",\"foo.hs\",\"bar.hs\"]"]
--- >>> let actual = driver ["foo.hs", "bar.hs", "baz.qux"] Nothing
--- >>> expected == actual
--- True
+-- >>> putStrLn $ driver ["foo.hs", "bar.hs", "baz.qux"] Nothing
+-- module Main where
+-- import Test.DocTest
+-- main :: IO ()
+-- main = doctest
+--     [ "-isrc"
+--     , "foo.hs"
+--     , "bar.hs"
+--     ]
+-- <BLANKLINE>
 --
 driver :: [FilePath] -> Maybe Config -> String
-driver files config = unlines $ ["module Main where", "import Test.DocTest", "main :: IO ()", "main = doctest " ++ (show $ generateConfig files config)]
+driver files config = unlines
+    [ "module Main where"
+    , "import Test.DocTest"
+    , "main :: IO ()"
+    , "main = doctest"
+    ] ++ (renderList 1 $ generateConfig files config)
+  where
+    renderList :: Show a => Int -> [a] -> String
+    renderList indent xs =
+        let (line:lines) = show <$> xs
+            lines' = ("[ " ++ line) : ((", " ++) <$> lines) ++ ["]"]
+        in  unlines $ indentOne indent <$> lines'
+    indentOne indent = (replicate (4 * indent) ' ' ++)
 
 -- | Generates doctest configuration
 --
