diff --git a/CHANGES.markdown b/CHANGES.markdown
--- a/CHANGES.markdown
+++ b/CHANGES.markdown
@@ -1,3 +1,15 @@
+## [v0.8](https://github.com/diagrams/diagrams-builder/tree/v0.8) (2016-10-26)
+
+- `diagrams-builder-pgf`: add catch-all case for file extension
+- Better defaults ([#29](https://github.com/diagrams/diagrams-builder/issues/29)):
+    - default extension will be chosen based on backend
+    - `input` option automatically selected when using `pgf` backend
+    - `diagrams` is now default output directory
+- Modules [can now be imported qualified](https://github.com/diagrams/diagrams-builder/pull/17)
+- allow `lens-4.15`
+- Require `haskell-src-exts-1.18` and `haskell-src-exts-simple`
+- Require `diagrams-*-1.4`
+
 ## [v0.7.2.4](https://github.com/diagrams/diagrams-builder/tree/v0.7.2.4) (2016-09-05)
 
 Update upper bounds, and build with GHC 8.  Allow:
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -1,10 +1,12 @@
-Copyright (c) 2012-2015 diagrams-builder team:
+Copyright (c) 2012-2016 diagrams-builder team:
 
   Daniel Bergey <bergey@alum.mit.edu>
   Jeroen Bransen <J.Bransen@uu.nl>
   Christopher Chalmers <c.chalmers@me.com>
   Anthony Cowley <acowley@gmail.com>
+  Corentin Dupont <corentin.dupont@gmail.com>
   Yiding Jia <yiding@fb.com>
+  Sidharth Kapur <sidharthkapur1@gmail.com>
   Jeffrey Rosenbluth <jeffrey.rosenbluth@gmail.com>
   Ryan Yates <fryguybob@gmail.com>
   Brent Yorgey <byorgey@gmail.com>
diff --git a/diagrams-builder.cabal b/diagrams-builder.cabal
--- a/diagrams-builder.cabal
+++ b/diagrams-builder.cabal
@@ -1,5 +1,5 @@
 name:                diagrams-builder
-version:             0.7.2.4
+version:             0.8
 synopsis:            hint-based build service for the diagrams graphics EDSL.
 
 description:         @diagrams-builder@ provides backend-agnostic tools for
@@ -37,7 +37,7 @@
 category:            Graphics
 build-type:          Simple
 cabal-version:       >=1.10
-tested-with:         GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.1
+tested-with:         GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1
 bug-reports:         https://github.com/diagrams/diagrams-builder/issues
 Source-repository head
   type:     git
@@ -51,15 +51,16 @@
   build-depends:       base >=4.2 && < 4.10,
                        base-orphans >= 0.3 && < 0.6,
                        mtl >= 2.1 && < 2.3,
-                       diagrams-lib >= 1.3 && < 1.4,
+                       diagrams-lib >= 1.4 && < 1.5,
                        hint >= 0.4 && < 0.7,
                        directory,
                        filepath,
                        transformers >= 0.3 && < 0.6,
                        split >= 0.2 && < 0.3,
-                       haskell-src-exts >= 1.16 && < 1.18,
+                       haskell-src-exts >= 1.18 && < 1.19,
+                       haskell-src-exts-simple >= 1.18 && < 1.19,
                        cmdargs >= 0.6 && < 0.11,
-                       lens >= 4.0 && < 4.15,
+                       lens >= 4.0 && < 4.16,
                        hashable >= 1.1 && < 1.3,
                        exceptions >= 0.3 && < 0.9
   hs-source-dirs:      src
@@ -114,10 +115,10 @@
                        filepath,
                        directory,
                        diagrams-builder,
-                       diagrams-lib >= 1.3 && < 1.4,
-                       diagrams-cairo >= 1.3 && < 1.4,
+                       diagrams-lib >= 1.4 && < 1.5,
+                       diagrams-cairo >= 1.4 && < 1.5,
                        cmdargs >= 0.6 && < 0.11,
-                       lens >= 4.0 && < 4.15
+                       lens >= 4.0 && < 4.16
 
 executable diagrams-builder-svg
   main-is:             diagrams-builder-svg.hs
@@ -134,8 +135,8 @@
                        filepath,
                        directory,
                        diagrams-builder,
-                       diagrams-lib >= 0.6 && < 1.4,
-                       diagrams-svg >= 0.8.0.1 && < 1.5,
+                       diagrams-lib >= 1.4 && < 1.5,
+                       diagrams-svg >= 1.4 && < 1.5,
                        svg-builder >= 0.1 && < 0.2,
                        bytestring >= 0.9.2 && < 0.11,
                        cmdargs >= 0.6 && < 0.11
@@ -155,10 +156,10 @@
                        filepath,
                        directory,
                        diagrams-builder,
-                       diagrams-lib >= 0.6 && < 1.4,
-                       diagrams-postscript >= 0.6 && < 1.4,
+                       diagrams-lib >= 1.4 && < 1.5,
+                       diagrams-postscript >= 1.4 && < 1.5,
                        cmdargs >= 0.6 && < 0.11,
-                       lens >= 3.8 && < 4.15
+                       lens >= 3.8 && < 4.16
 
 executable diagrams-builder-rasterific
   main-is:             diagrams-builder-rasterific.hs
@@ -175,10 +176,10 @@
                        filepath,
                        directory,
                        diagrams-builder,
-                       diagrams-lib >= 0.6 && < 1.4,
-                       diagrams-rasterific >= 1.3 && < 1.4,
+                       diagrams-lib >= 1.4 && < 1.5,
+                       diagrams-rasterific >= 1.4 && < 1.5,
                        cmdargs >= 0.6 && < 0.11,
-                       lens >= 3.8 && < 4.15,
+                       lens >= 3.8 && < 4.16,
                        JuicyPixels >= 3.1.5 && < 3.3
 
 executable diagrams-builder-pgf
@@ -196,8 +197,8 @@
                        filepath,
                        directory,
                        diagrams-builder,
-                       diagrams-lib >= 0.6 && < 1.4,
-                       diagrams-pgf,
+                       diagrams-lib >= 1.4 && < 1.5,
+                       diagrams-pgf >= 1.4 && < 1.5,
                        bytestring >= 0.10.2 && < 0.11,
                        cmdargs >= 0.6 && < 0.11,
-                       lens >= 3.8 && < 4.15
+                       lens >= 3.8 && < 4.16
diff --git a/latex/diagrams-latex.sty b/latex/diagrams-latex.sty
--- a/latex/diagrams-latex.sty
+++ b/latex/diagrams-latex.sty
@@ -58,6 +58,7 @@
 \ProvidesPackage{diagrams-latex}[2012/04/07 v0.1 Generate diagrams embedded within LaTeX]
 \RequirePackage{moreverb}
 \RequirePackage{xkeyval}[2005/02/22]
+\RequirePackage{ifthen}
 
 \newif\ifdtt@ShellEscape
 %\newif\ifmiktex \miktexfalse
@@ -78,7 +79,7 @@
 
 % Option for setting an output directory
 \DeclareOptionX{outputdir}[]{\def\dtt@outputdir{#1}}
-\def\dtt@outputdir{}
+\def\dtt@outputdir{diagrams}
 \DeclareOptionX{debug}{\dtt@debugtrue}
 
 \newcommand\setoutputdir[1]{\def\dtt@outputdir{#1}}
@@ -87,7 +88,6 @@
 \DeclareOptionX{backend}[]{\def\dtt@backend{#1}}
 \def\dtt@backend{cairo}  % use cairo as the default backend
 \DeclareOptionX{extension}[]{\def\dtt@extension{#1}}
-\def\dtt@extension{pdf}  % default output extension of .pdf
 \newif\ifdtt@input \dtt@inputfalse
 \DeclareOptionX{input}{\dtt@inputtrue}
 \DeclareOptionX{noinput}{\dtt@inputfalse}
@@ -96,6 +96,16 @@
 
 \ProcessOptionsX\relax
 
+%% Handle option defaults for backends
+
+\ifthenelse{\equal{\dtt@backend}{cairo} \and \isundefined{\dtt@extension}}
+  {\def\dtt@extension{pdf}}{}
+\ifthenelse{\equal{\dtt@backend}{pgf} \and \isundefined{\dtt@extension}}
+  {\def\dtt@extension{pgf}}{}
+\ifthenelse{\equal{\dtt@backend}{ps} \and \isundefined{\dtt@extension}}
+  {\def\dtt@extension{eps}}{}
+
+\ifthenelse{\equal{\dtt@backend}{pgf}}{\dtt@inputtrue}{}
 
 %% The platform detection code is copied from the ifplatform package
 %% avaialable from: http://tug.ctan.org/tex-archive/macros/latex/contrib/ifplatform/
diff --git a/src/Diagrams/Builder.hs b/src/Diagrams/Builder.hs
--- a/src/Diagrams/Builder.hs
+++ b/src/Diagrams/Builder.hs
@@ -4,6 +4,7 @@
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE ScopedTypeVariables   #-}
 {-# LANGUAGE StandaloneDeriving    #-}
+{-# LANGUAGE TupleSections         #-}
 {-# OPTIONS_GHC -fno-warn-orphans  #-}
 
 -----------------------------------------------------------------------------
@@ -21,7 +22,7 @@
        ( -- * Building diagrams
 
          -- ** Options
-         BuildOpts(..), mkBuildOpts, backendOpts, snippets, pragmas, imports, decideRegen, diaExpr, postProcess
+         BuildOpts(..), mkBuildOpts, backendOpts, snippets, pragmas, imports, qimports, decideRegen, diaExpr, postProcess
 
          -- ** Regeneration decision functions and hashing
        , alwaysRegenerate, hashedRegenerate
@@ -43,6 +44,7 @@
 
        ) where
 
+import           Control.Arrow                       (second)
 import           Control.Monad                       (guard, mplus, mzero)
 import           Control.Monad.Catch                 (MonadMask, catchAll)
 import           Control.Monad.Trans.Maybe           (MaybeT, runMaybeT)
@@ -61,8 +63,7 @@
 import           System.IO                           (hClose, hPutStr,
                                                       openTempFile)
 
-import           Language.Haskell.Exts               (ImportDecl, Module (..),
-                                                      importModule, prettyPrint)
+import           Language.Haskell.Exts.Simple
 import           Language.Haskell.Interpreter        hiding (ModuleName)
 
 import           Diagrams.Builder.CmdLine
@@ -87,22 +88,23 @@
   => String
      -- ^ Filename of the module containing the diagrams
 
-  -> [String]
-     -- ^ Additional necessary imports. @Prelude@, @Diagrams.Prelude@,
-     --   @Diagrams.Core.Types@, and @Data.Monoid@ are included by
-     --   default.
+  -> [(String, Maybe String)]
+     -- ^ Additional necessary imports, along with qualified names.
+     --   @Prelude@, @Diagrams.Prelude@, @Diagrams.Core.Types@, and
+     --   @Data.Monoid@ are included (unqualified) by default.
 
   -> m ()
 
 setDiagramImports m imps = do
     loadModules [m]
     setTopLevelModules [takeBaseName m]
-    setImports $ [ "Prelude"
-                 , "Diagrams.Prelude"
-                 , "Diagrams.Core.Types"
-                 , "Data.Monoid"
-                 ]
-                 ++ imps
+    setImportsQ $
+      map (, Nothing)
+        [ "Prelude"
+        , "Diagrams.Prelude"
+        , "Data.Monoid"
+        ]
+        ++ imps
 
 -- | Run an interpretor using sandbox from 'findSandbox'.
 runSandboxInterpreter :: (MonadMask m, MonadIO m, Functor m)
@@ -135,7 +137,8 @@
 
   runSandboxInterpreter $ do
 
-    setDiagramImports m (bopts ^. imports)
+    setDiagramImports m $
+      map (,Nothing) (bopts ^. imports) ++ map (second Just) (bopts ^. qimports)
     let dexp = bopts ^. diaExpr
 
     -- Try interpreting the diagram expression at two types: Diagram
@@ -192,7 +195,7 @@
              & imports  %~ ("Diagrams.Prelude" :)
   case createModule Nothing bopts' of
     Left  err -> return (ParseErr err)
-    Right m@(Module _ _ _ _ _ srcImps _) -> do
+    Right m@(Module _ _ srcImps _) -> do
       liHash <- hashLocalImports srcImps
       let diaHash
             = 0 `hashWithSalt` prettyPrint m
diff --git a/src/Diagrams/Builder/Modules.hs b/src/Diagrams/Builder/Modules.hs
--- a/src/Diagrams/Builder/Modules.hs
+++ b/src/Diagrams/Builder/Modules.hs
@@ -1,3 +1,14 @@
+-- Module SrcLoc ModuleName [ModulePragma] (Maybe WarningText) (Maybe [ExportSpec]) [ImportDecl] [Decl]
+--
+-- Module :: Maybe ModuleHead -> [ModulePragma] -> [ImportDecl] -> [Decl] -> Module
+-- ModuleHead :: ModuleName -> Maybe WarningText -> Maybe ExportSpecList -> ModuleHead
+
+-- so (Module sl *mn ps *w *exp imp decl)
+--
+-- -> Module (Just (ModuleHead mn w exp)) ps imp decl
+
+{-# LANGUAGE TupleSections #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Diagrams.Builder.Modules
@@ -11,14 +22,16 @@
 
 module Diagrams.Builder.Modules where
 
+import           Control.Arrow                (second)
 import           Control.Lens                 ((^.))
 import           Data.Function                (on)
+import           Data.Functor                 ((<$>))
 import           Data.List                    (foldl', groupBy, isPrefixOf, nub,
                                                sortBy)
+import           Data.Maybe                   (isJust)
 import           Data.Ord                     (comparing)
 
-import           Language.Haskell.Exts
-import           Language.Haskell.Exts.SrcLoc (noLoc)
+import           Language.Haskell.Exts.Simple
 
 import           Diagrams.Builder.Opts
 
@@ -43,12 +56,12 @@
     . deleteExports
     . maybe id replaceModuleName nm
     . addPragmas (opts ^. pragmas)
-    . addImports (opts ^. imports)
+    . addImports (map (,Nothing) (opts ^. imports) ++ map (second Just) (opts ^. qimports))
     . foldl' combineModules emptyModule
     $ ms
 
 emptyModule :: Module
-emptyModule = Module noLoc (ModuleName "Main") [] Nothing Nothing [] []
+emptyModule = Module (Just (ModuleHead (ModuleName "Main") Nothing Nothing)) [] [] []
 
 -- | Run the haskell-src-exts parser on a @String@ representing some
 --   Haskell code, producing a @Module@ or an error message.
@@ -74,26 +87,35 @@
 
 -- | Replace the name of a module.
 replaceModuleName :: String -> Module -> Module
-replaceModuleName m (Module l _ p w e i d) = Module l (ModuleName m) p w e i d
+replaceModuleName m (Module Nothing p i d)
+  = Module (Just (ModuleHead (ModuleName m) Nothing Nothing)) p i d
+replaceModuleName m (Module (Just (ModuleHead _ w e)) p i d)
+  = Module (Just (ModuleHead (ModuleName m) w e)) p i d
 
 -- | Delete module exports.
 deleteExports :: Module -> Module
-deleteExports (Module l n p w _ i d) = Module l n p w Nothing i d
+deleteExports m@(Module Nothing _ _ _) = m
+deleteExports (Module (Just (ModuleHead n w _)) p i d)
+  = Module (Just (ModuleHead n w Nothing)) p i d
 
 -- | Add some @LANGUAGE@ pragmas to a module if necessary.
 addPragmas :: [String] -> Module -> Module
-addPragmas langs (Module l n p w e i d) = Module l n (f p) w e i d
-  where f [] = [LanguagePragma noLoc (map Ident langs)]
-        f (LanguagePragma lpLoc ps : rest) = LanguagePragma lpLoc (ps ++ map Ident langs) : rest
+addPragmas langs (Module h p i d) = Module h (f p) i d
+  where f [] = [LanguagePragma (map Ident langs)]
+        f (LanguagePragma ps : rest) = LanguagePragma (ps ++ map Ident langs) : rest
         f (x : rest) = x : f rest
 
 -- | Add some imports to a module if necessary.
-addImports :: [String] -> Module -> Module
-addImports imps (Module l n p w e i d) = Module l n p w e (foldr addImport i imps) d
-  where addImport imp is
-          | any ((==imp) . getModuleName . importModule) is = is
-          | otherwise = ImportDecl noLoc (ModuleName imp) False False False
-                                   Nothing Nothing Nothing : is
+addImports :: [(String, Maybe String)] -> Module -> Module
+addImports imps (Module h p i d) = Module h p (foldr addImport i imps) d
+  where addImport (imp, mq) is
+          | any (sameImport imp mq) is = is
+          | otherwise = ImportDecl (ModuleName imp) (isJust mq) False False
+                                   Nothing (ModuleName <$> mq) Nothing : is
+        sameImport imp mq imp' =
+             ((==imp) . getModuleName . importModule) imp'
+          && (isJust mq == importQualified imp')
+          && ((ModuleName <$> mq) == importAs imp')
 
 -- | Combine two modules into one, with a left bias in the case of
 --   things that can't be sensibly combined (/e.g./ the module name).
@@ -101,9 +123,9 @@
 --   different import specifications (qualification, hiding, explicit
 --   import) is unlikely to work sensibly.
 combineModules :: Module -> Module -> Module
-combineModules (Module l1 n1 ps1 w1 e1 i1 d1)
-               (Module _  _  ps2 _  _  i2 d2) =
-    Module l1 n1 combinedPragmas w1 e1 combinedImports (d1 ++ d2)
+combineModules (Module h ps1 i1 d1)
+               (Module _ ps2 i2 d2) =
+    Module h combinedPragmas combinedImports (d1 ++ d2)
   where
     combinedPragmas = combinedLangPragmas ++ otherPragmas ps1 ++ otherPragmas ps2
     combinedImports = map head
@@ -112,11 +134,11 @@
                     $ i1 ++ i2
 
     combinedLangPragmas
-      = [LanguagePragma noLoc (nub (getLangPragmas ps1 ++ getLangPragmas ps2))]
+      = [LanguagePragma (nub (getLangPragmas ps1 ++ getLangPragmas ps2))]
 
     getLangPragmas = concatMap getLangPragma
-    getLangPragma (LanguagePragma _ ns) = ns
-    getLangPragma _                     = []
+    getLangPragma (LanguagePragma ns) = ns
+    getLangPragma _                   = []
 
     otherPragmas = filter (not . isLangPragma)
     isLangPragma (LanguagePragma {}) = True
diff --git a/src/Diagrams/Builder/Opts.hs b/src/Diagrams/Builder/Opts.hs
--- a/src/Diagrams/Builder/Opts.hs
+++ b/src/Diagrams/Builder/Opts.hs
@@ -20,7 +20,7 @@
     ( -- * Options
 
       Hash
-    , BuildOpts(..), mkBuildOpts, backendOpts, snippets, pragmas, imports, decideRegen, diaExpr, postProcess
+    , BuildOpts(..), mkBuildOpts, backendOpts, snippets, pragmas, imports, qimports, decideRegen, diaExpr, postProcess
 
       -- * Rebuilding
 
@@ -34,7 +34,7 @@
 import           System.FilePath  (takeBaseName)
 import           Text.Printf
 
-import           Diagrams.Prelude (QDiagram, Options, Any)
+import           Diagrams.Prelude (Any, Options, QDiagram)
 
 -- | Synonym for more perspicuous types.
 --
@@ -66,6 +66,7 @@
     , _snippets    :: [String]
     , _pragmas     :: [String]
     , _imports     :: [String]
+    , _qimports    :: [(String, String)]
     , _decideRegen :: Hash -> IO (Maybe (Options b v n -> Options b v n))
     , _diaExpr     :: String
     , _postProcess :: QDiagram b v n Any -> QDiagram b v n Any
@@ -88,7 +89,7 @@
 --   * no postprocessing
 mkBuildOpts :: b -> v n -> Options b v n -> BuildOpts b v n
 mkBuildOpts b v opts
-  = BuildOpts b v opts [] [] [] alwaysRegenerate "circle 1" id
+  = BuildOpts b v opts [] [] [] [] alwaysRegenerate "circle 1" id
 
 -- | Backend-specific options to use.
 backendOpts :: Lens' (BuildOpts b v n) (Options b v n)
@@ -106,6 +107,10 @@
 -- | Additional module imports (note that "Diagrams.Prelude" is
 --   automatically imported).
 imports :: Lens' (BuildOpts b v n) [String]
+
+-- | Additional qualified module imports (module name, qualified
+--   name).
+qimports :: Lens' (BuildOpts b v n) [(String, String)]
 
 -- | A function to decide whether a particular diagram needs to be
 --   regenerated.  It will be passed a hash of the final assembled
diff --git a/src/tools/diagrams-builder-pgf.hs b/src/tools/diagrams-builder-pgf.hs
--- a/src/tools/diagrams-builder-pgf.hs
+++ b/src/tools/diagrams-builder-pgf.hs
@@ -22,6 +22,7 @@
       standalone = case ext of
                      ".pgf" -> False
                      ".tex" -> True
+                     _      -> False
   f   <- readFile srcFile
 
   createDirectoryIfMissing True dir
