diff --git a/CHANGELOG b/CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,10 @@
+0.6
+---
+* Add option '--as'
+
+    $> hsimport -m 'Control.Monad' --as 'CM' SomeSource.hs
+    => import Control.Monad as CM
+
 0.5.2
 -----
 * Build/tested with GHC 7.8.3
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -26,6 +26,9 @@
     $> hsimport -m 'Control.Monad' -q 'CM' SomeSource.hs
     => import qualified Control.Monad as CM
 
+    $> hsimport -m 'Control.Monad' --as 'CM' SomeSource.hs
+    => import Control.Monad as CM
+
     $> hsimport -m 'Data.Maybe' -s 'Maybe'
     => import Data.Maybe (Maybe)
 
diff --git a/hsimport.cabal b/hsimport.cabal
--- a/hsimport.cabal
+++ b/hsimport.cabal
@@ -1,5 +1,5 @@
 name: hsimport
-version: 0.5.2
+version: 0.6
 cabal-version: >=1.9.2
 build-type: Simple
 license: BSD3
@@ -29,7 +29,7 @@
         haskell-src-exts >=1.14.0 && <1.16,
         lens >=3.9.2 && <4.5,
         mtl >=2.1.2 && <2.3,
-        text >=0.11.3.1 && <1.2,
+        text >=0.11.3.1 && <1.3,
         split >=0.2.2 && <0.3,
         attoparsec >=0.10.4.0 && <0.13,
         directory >=1.2.0.1 && <1.3,
@@ -39,14 +39,15 @@
         HsImport.Main
         HsImport.Config
         HsImport.Args
-        HsImport.ImportSpec
-        HsImport.Symbol
         HsImport.ImportPos
     exposed: True
     buildable: True
     cpp-options: -DCABAL
     hs-source-dirs: lib
     other-modules:
+        HsImport.ImportSpec
+        HsImport.Module
+        HsImport.Symbol
         HsImport.ImportChange
         HsImport.Parse
         HsImport.PrettyPrint
@@ -68,7 +69,7 @@
 test-suite hsimport-tests
     build-depends:
         base >=3 && <5,
-        tasty >=0.6 && <0.9,
+        tasty >=0.6 && <0.11,
         tasty-golden >=2.2.0.1 && <2.3,
         filepath >=1.3.0.1 && <1.4,
         haskell-src-exts >=1.14.0 && <1.16,
diff --git a/lib/HsImport.hs b/lib/HsImport.hs
--- a/lib/HsImport.hs
+++ b/lib/HsImport.hs
@@ -2,9 +2,11 @@
 module HsImport
    ( module HsImport.Main
    , module HsImport.Config
+   , module HsImport.Args
    , ImportPos(..)
    ) where
 
 import HsImport.Main
 import HsImport.Config
+import HsImport.Args
 import HsImport.ImportPos (ImportPos(..))
diff --git a/lib/HsImport/Args.hs b/lib/HsImport/Args.hs
--- a/lib/HsImport/Args.hs
+++ b/lib/HsImport/Args.hs
@@ -20,18 +20,21 @@
    , all           :: Bool
    , with          :: [String]
    , qualifiedName :: String
+   , as            :: String
    , inputSrcFile  :: FilePath
    , outputSrcFile :: FilePath
    } deriving (Data, Typeable, Show, Eq)
 
 
 hsImportArgs :: IO HsImportArgs
-hsImportArgs = cmdArgs $ HsImportArgs 
+hsImportArgs = cmdArgs $ HsImportArgs
    { moduleName    = def &= help "The module to import"
    , symbolName    = def &= help "The symbol to import, if empty, the entire module is imported"
    , all           = def &= help "All constructors or methods of the symbol should be imported: 'Symbol(..)'"
+                         &= name "all" &= name "a"
    , with          = def &= help "The constructors or methods of the symbol should be imported: 'Symbol(With)'"
    , qualifiedName = def &= help "The name to use for a qualified module import"
+   , as            = def &= help "The name to use for an unqualified module import" &= name "as"
    , outputSrcFile = def &= help "Save modified source file to file, if empty, the source file is modified inplace" &= typFile
    , inputSrcFile  = def &= args &= typ "SOURCEFILE"
    }
@@ -51,6 +54,7 @@
    , all           = def
    , with          = def
    , qualifiedName = def
+   , as            = def
    , inputSrcFile  = def
    , outputSrcFile = def
    }
diff --git a/lib/HsImport/ImportChange.hs b/lib/HsImport/ImportChange.hs
--- a/lib/HsImport/ImportChange.hs
+++ b/lib/HsImport/ImportChange.hs
@@ -11,6 +11,7 @@
 import qualified Language.Haskell.Exts as HS
 import qualified Data.Attoparsec.Text as A
 import HsImport.Symbol (Symbol(..))
+import HsImport.Module (Module(..))
 import HsImport.ImportPos (matchingImports)
 import HsImport.Utils
 
@@ -25,20 +26,20 @@
                   deriving (Show)
 
 
-importChanges :: String -> Maybe Symbol -> Maybe String -> HS.Module -> [ImportChange]
-importChanges moduleName (Just symbol) (Just qualifiedName) module_ =
-   [ importModuleWithSymbol moduleName symbol module_
-   , importQualifiedModule moduleName qualifiedName module_
-   ]
+importChanges :: Module -> Maybe Symbol -> HS.Module -> [ImportChange]
+importChanges (Module moduleName False Nothing) Nothing hsModule =
+   [ importModule moduleName hsModule ]
 
-importChanges moduleName (Just symbol) Nothing module_ =
-   [ importModuleWithSymbol moduleName symbol module_ ]
+importChanges (Module moduleName False Nothing) (Just symbol) hsModule =
+   [ importModuleWithSymbol moduleName symbol hsModule ]
 
-importChanges moduleName Nothing (Just qualifiedName) module_ =
-   [ importQualifiedModule moduleName qualifiedName module_ ]
+importChanges (Module moduleName qualified as) symbol hsModule =
+   [ maybe NoImportChange (\sym -> importModuleWithSymbol moduleName sym hsModule) symbol
 
-importChanges moduleName Nothing Nothing module_ =
-   [ importModule moduleName module_ ]
+   , if qualified
+        then importQualifiedModule moduleName (maybe moduleName id as) hsModule
+        else maybe NoImportChange (\asName -> importModuleAs moduleName asName hsModule) as
+   ]
 
 
 importModule :: String -> HS.Module -> ImportChange
@@ -97,6 +98,22 @@
            Nothing      -> AddImportAtEnd (qualifiedImportDecl moduleName qualifiedName)
 
 
+importModuleAs :: String -> String -> HS.Module -> ImportChange
+importModuleAs moduleName asName module_
+   | matching@(_:_) <- matchingImports moduleName (importDecls module_) =
+      if any (hasAsImport asName) matching
+         then NoImportChange
+         else FindImportPos $ asImportDecl moduleName asName
+
+   | not $ null (importDecls module_) =
+      FindImportPos $ asImportDecl moduleName asName
+
+   | otherwise =
+      case srcLineForNewImport module_ of
+           Just srcLine -> AddImportAfter srcLine (asImportDecl moduleName asName)
+           Nothing      -> AddImportAtEnd (asImportDecl moduleName asName)
+
+
 entireModuleImported :: HS.ImportDecl -> Bool
 entireModuleImported import_ =
    not (HS.importQualified import_) && isNothing (HS.importSpecs import_)
@@ -112,6 +129,17 @@
    | otherwise = False
 
 
+hasAsImport :: String -> HS.ImportDecl -> Bool
+hasAsImport asName import_
+   | not $ HS.importQualified import_
+   , Just (HS.ModuleName importAs) <- HS.importAs import_
+   , importAs == asName
+   = True
+
+   | otherwise
+   = False
+
+
 symbolImported :: Symbol -> HS.ImportDecl -> Bool
 symbolImported symbol import_
    | Just (False, hsSymbols) <- HS.importSpecs import_
@@ -168,6 +196,13 @@
                            , HS.importAs        = if moduleName /= qualifiedName
                                                      then Just $ HS.ModuleName qualifiedName
                                                      else Nothing
+                           }
+
+
+asImportDecl :: String -> String -> HS.ImportDecl
+asImportDecl moduleName asName =
+   (importDecl moduleName) { HS.importQualified = False
+                           , HS.importAs        = Just $ HS.ModuleName asName
                            }
 
 
diff --git a/lib/HsImport/ImportSpec.hs b/lib/HsImport/ImportSpec.hs
--- a/lib/HsImport/ImportSpec.hs
+++ b/lib/HsImport/ImportSpec.hs
@@ -2,33 +2,24 @@
 
 module HsImport.ImportSpec
    ( ImportSpec(..)
-   , sourceFile
-   , parsedSrcFile
-   , moduleToImport
-   , symbolToImport
-   , qualifiedName
-   , saveToFile
    , hsImportSpec
    ) where
 
-import Control.Lens
 import qualified Language.Haskell.Exts as HS
 import qualified HsImport.Args as Args
 import HsImport.Args (HsImportArgs)
 import HsImport.Parse (parseFile)
 import HsImport.Symbol (Symbol(..))
-
-data ImportSpec = ImportSpec 
-   { _sourceFile       :: FilePath
-   , _parsedSrcFile    :: HS.Module
-   , _moduleToImport   :: String
-   , _symbolToImport   :: Maybe Symbol
-   , _qualifiedName    :: Maybe String
-   , _saveToFile       :: Maybe FilePath
-   } deriving (Show)  
-
+import HsImport.Module
+import Data.List (find)
 
-makeLenses ''ImportSpec
+data ImportSpec = ImportSpec
+   { sourceFile     :: FilePath
+   , parsedSrcFile  :: HS.Module
+   , moduleToImport :: Module
+   , symbolToImport :: Maybe Symbol
+   , saveToFile     :: Maybe FilePath
+   } deriving (Show)
 
 
 type Error = String
@@ -38,16 +29,24 @@
    | otherwise = do
       result <- parseFile $ Args.inputSrcFile args
       case result of
-           Right (HS.ParseOk modul) -> return $ Right $
-              ImportSpec (Args.inputSrcFile args) modul
-                         (Args.moduleName args) symbol
-                         qualifiedName saveToFile
+           Right (HS.ParseOk hsModule) -> return $ Right $
+              ImportSpec { sourceFile    = Args.inputSrcFile args
+                         , parsedSrcFile = hsModule
+                         , moduleToImport = module_
+                         , symbolToImport = symbol
+                         , saveToFile     = saveToFile
+                         }
 
            Right (HS.ParseFailed srcLoc error) -> return $ Left (show srcLoc ++ error)
 
            Left error -> return $ Left error
 
    where
+      module_ = Module { moduleName = Args.moduleName args
+                       , qualified  = not . null $ Args.qualifiedName args
+                       , as         = find (/= "") [Args.qualifiedName args, Args.as args]
+                       }
+
       symbol =
          case Args.symbolName args of
               ""  -> Nothing
@@ -56,17 +55,23 @@
                    | ws@(_:_) <- Args.with args -> Just $ SomeOfSymbol name ws
                    | otherwise                  -> Just $ Symbol name
 
-      qualifiedName =
-         case Args.qualifiedName args of
-              "" -> Nothing
-              qn -> Just qn
-
       saveToFile =
          case Args.outputSrcFile args of
               "" -> Nothing
               fp -> Just fp
 
       checkArgs args
-         | null . Args.inputSrcFile $ args = Just "Missing source file!"
-         | null . Args.moduleName $ args   = Just "Missing module name!"
-         | otherwise                       = Nothing
+         | null . Args.inputSrcFile $ args
+         = Just "Missing source file!"
+
+         | null . Args.moduleName $ args
+         = Just "Missing module name!"
+
+         | (not . null $ qualifiedName) && (not . null $ asName)
+         = Just "Invalid usage of options '--qualifiedname' and '--as' at once!"
+
+         | otherwise
+         = Nothing
+         where
+            qualifiedName = Args.qualifiedName args
+            asName        = Args.as args
diff --git a/lib/HsImport/Main.hs b/lib/HsImport/Main.hs
--- a/lib/HsImport/Main.hs
+++ b/lib/HsImport/Main.hs
@@ -2,10 +2,9 @@
 
 module HsImport.Main
    ( hsimport
-   , hsimport_
+   , hsimportWithArgs
    ) where
 
-import Control.Lens
 import Control.Applicative ((<$>))
 import Control.Monad (when)
 import System.Exit (exitFailure, exitSuccess)
@@ -24,6 +23,7 @@
 import qualified HsImport.Parse as P
 
 
+hsimport :: Config -> IO ()
 hsimport = Dyre.wrapMain $ Dyre.defaultParams
    { Dyre.projectName = "hsimport"
    , Dyre.realMain    = realMain
@@ -36,23 +36,29 @@
               Just error -> hPutStrLn stderr ("hsimport: " ++ error) >> exitFailure
               _          -> return ()
 
-         args      <- Args.hsImportArgs
-         maybeSpec <- hsImportSpec args
-         case maybeSpec of
-              Left  error -> hPutStrLn stderr ("hsimport: " ++ error) >> exitFailure
-              Right spec  -> hsimport_ config spec                    >> exitSuccess
+         args     <- Args.hsImportArgs
+         maybeErr <- hsimportWithArgs config args
+         case maybeErr of
+              Just err -> hPutStrLn stderr ("hsimport: " ++ err) >> exitFailure
+              _        -> exitSuccess
 
 
-hsimport_ :: Config -> ImportSpec -> IO ()
-hsimport_ Config { prettyPrint = prettyPrint, findImportPos = findImportPos } spec = do
-   let impChanges = importChanges (spec ^. moduleToImport)
-                                  (spec ^. symbolToImport)
-                                  (spec ^. qualifiedName)
-                                  (spec ^. parsedSrcFile)
+type Error = String
+hsimportWithArgs :: Config -> Args.HsImportArgs -> IO (Maybe Error)
+hsimportWithArgs config args = do
+   maybeSpec <- hsImportSpec args
+   case maybeSpec of
+        Left  error -> return $ Just error
+        Right spec  -> hsimportWithSpec config spec >> return Nothing
 
-   srcLines <- lines . T.unpack <$> TIO.readFile (spec ^. sourceFile)
+
+hsimportWithSpec :: Config -> ImportSpec -> IO ()
+hsimportWithSpec Config { prettyPrint = prettyPrint, findImportPos = findImportPos } spec = do
+   let impChanges = importChanges (moduleToImport spec) (symbolToImport spec) (parsedSrcFile spec)
+
+   srcLines <- lines . T.unpack <$> TIO.readFile (sourceFile spec)
    let srcLines' = applyChanges srcLines impChanges
-   when (srcLines' /= srcLines || isJust (spec ^. saveToFile)) $
+   when (srcLines' /= srcLines || isJust (saveToFile spec)) $
       TIO.writeFile (outputFile spec) (T.pack $ unlines srcLines')
 
    where
@@ -80,8 +86,8 @@
       applyChange srcLines NoImportChange = srcLines
 
       outputFile spec
-         | Just file <- spec ^. saveToFile = file
-         | otherwise                       = spec ^. sourceFile
+         | Just file <- saveToFile spec = file
+         | otherwise                    = sourceFile spec
 
       lastImportSrcLine fstLine srcLines
          | Just lastLine <- P.lastImportSrcLine $ drop (max 0 (fstLine - 1)) srcLines
@@ -90,4 +96,4 @@
          | otherwise
          = fstLine
 
-      allImportDecls = importDecls $ spec ^. parsedSrcFile
+      allImportDecls = importDecls $ parsedSrcFile spec
diff --git a/lib/HsImport/Module.hs b/lib/HsImport/Module.hs
new file mode 100644
--- /dev/null
+++ b/lib/HsImport/Module.hs
@@ -0,0 +1,13 @@
+
+module HsImport.Module
+   ( Module(..)
+   , Name
+   ) where
+
+type Name = String
+
+-- | How the module should be imported
+data Module = Module { moduleName :: Name       -- ^ the name of the module to import
+                     , qualified  :: Bool       -- ^ if the module should be imported qualified
+                     , as         :: Maybe Name -- ^ the module should be imported with this name
+                     } deriving (Show)
diff --git a/tests/Main.hs b/tests/Main.hs
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -7,11 +7,7 @@
 import System.IO (hPutStrLn, stderr)
 import Data.List (intercalate)
 import qualified Language.Haskell.Exts as HS
-import HsImport.Main (hsimport_)
-import HsImport.ImportSpec (hsImportSpec)
-import qualified HsImport.Config as C
-import qualified HsImport.Args as A
-import qualified HsImport.ImportPos as P
+import qualified HsImport as HI
 
 main = defaultMain tests
 
@@ -20,91 +16,92 @@
 
 moduleTests :: TestTree
 moduleTests = testGroup "Module Tests"
-   [ test "ModuleTest0" $ A.defaultArgs { A.moduleName = "Foo.Bar" }
-   , test "ModuleTest1" $ A.defaultArgs { A.moduleName = "Foo.Bar" }
-   , test "ModuleTest2" $ A.defaultArgs { A.moduleName = "Foo.Bar.Blub" }
-   , test "ModuleTest3" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest4" $ A.defaultArgs { A.moduleName = "Ugah.Argh2" }
-   , test "ModuleTest5" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest6" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest7" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest8" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest9" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest10" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest11" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest12" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest13" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest14" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest15" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest16" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest17" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest18" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest19" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest20" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest21" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest22" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test "ModuleTest23" $ A.defaultArgs { A.moduleName = "Control.Monad", A.qualifiedName = "CM" }
-   , test "ModuleTest24" $ A.defaultArgs { A.moduleName = "Control.Monad", A.qualifiedName = "CM" }
-   , test "ModuleTest25" $ A.defaultArgs { A.moduleName = "Control.Monad", A.qualifiedName = "Control.Monad" }
-   , test "ModuleTest26" $ A.defaultArgs { A.moduleName = "Control.Monad" }
-   , test_ "ModuleTest27" (C.defaultConfig { C.findImportPos = importPosBeforeFirst }) (A.defaultArgs { A.moduleName = "Control.Monad" })
-   , test_ "ModuleTest28" (C.defaultConfig { C.findImportPos = importPosAfterFirst }) (A.defaultArgs { A.moduleName = "Control.Monad" })
-   , test_ "ModuleTest29" (C.defaultConfig { C.findImportPos = importPosBeforeLast }) (A.defaultArgs { A.moduleName = "Control.Monad" })
-   , test_ "ModuleTest30" (C.defaultConfig { C.findImportPos = importPosAfterLast }) (A.defaultArgs { A.moduleName = "Control.Monad" })
+   [ test "ModuleTest0" $ HI.defaultArgs { HI.moduleName = "Foo.Bar" }
+   , test "ModuleTest1" $ HI.defaultArgs { HI.moduleName = "Foo.Bar" }
+   , test "ModuleTest2" $ HI.defaultArgs { HI.moduleName = "Foo.Bar.Blub" }
+   , test "ModuleTest3" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest4" $ HI.defaultArgs { HI.moduleName = "Ugah.Argh2" }
+   , test "ModuleTest5" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest6" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest7" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest8" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest9" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest10" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest11" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest12" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest13" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest14" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest15" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest16" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest17" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest18" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest19" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest20" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest21" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest22" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test "ModuleTest23" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.qualifiedName = "CM" }
+   , test "ModuleTest24" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.qualifiedName = "CM" }
+   , test "ModuleTest25" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.qualifiedName = "Control.Monad" }
+   , test "ModuleTest26" $ HI.defaultArgs { HI.moduleName = "Control.Monad" }
+   , test_ "ModuleTest27" (HI.defaultConfig { HI.findImportPos = importPosBeforeFirst }) (HI.defaultArgs { HI.moduleName = "Control.Monad" })
+   , test_ "ModuleTest28" (HI.defaultConfig { HI.findImportPos = importPosAfterFirst }) (HI.defaultArgs { HI.moduleName = "Control.Monad" })
+   , test_ "ModuleTest29" (HI.defaultConfig { HI.findImportPos = importPosBeforeLast }) (HI.defaultArgs { HI.moduleName = "Control.Monad" })
+   , test_ "ModuleTest30" (HI.defaultConfig { HI.findImportPos = importPosAfterLast }) (HI.defaultArgs { HI.moduleName = "Control.Monad" })
+   , test "ModuleTest31" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.as = "CM" }
    ]
 
 
 symbolTests :: TestTree
 symbolTests = testGroup "Symbol Tests"
-   [ test "SymbolTest0" $ A.defaultArgs { A.moduleName = "Foo.Bar", A.symbolName = "foo" }
-   , test "SymbolTest1" $ A.defaultArgs { A.moduleName = "Foo.Bar", A.symbolName = "foo" }
-   , test "SymbolTest2" $ A.defaultArgs { A.moduleName = "Foo.Bar.Blub", A.symbolName = "foo" }
-   , test "SymbolTest3" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "when" }
-   , test "SymbolTest4" $ A.defaultArgs { A.moduleName = "Ugah.Argh2", A.symbolName = "argh" }
-   , test "SymbolTest5" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "when" }
-   , test "SymbolTest6" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "unless" }
-   , test "SymbolTest7" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "unless" }
-   , test "SymbolTest8" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "unless" }
-   , test "SymbolTest9" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "unless" }
-   , test "SymbolTest10" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "<$>" }
-   , test "SymbolTest11" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "<$>" }
-   , test "SymbolTest12" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "<$>" }
-   , test "SymbolTest13" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "<*" }
-   , test "SymbolTest14" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "<*" }
-   , test "SymbolTest15" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "*>" }
-   , test "SymbolTest16" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "when", A.qualifiedName = "CM" }
-   , test "SymbolTest17" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "when", A.qualifiedName = "CM" }
-   , test "SymbolTest18" $ A.defaultArgs { A.moduleName = "Data.Text", A.symbolName = "Text" }
-   , test "SymbolTest19" $ A.defaultArgs { A.moduleName = "Data.List", A.symbolName = "foldl'" }
-   , test "SymbolTest20" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.all = True }
-   , test "SymbolTest21" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.all = True }
-   , test "SymbolTest22" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.with = ["Just"] }
-   , test "SymbolTest23" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.all = True, A.with = ["Just"] }
-   , test "SymbolTest24" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.with = ["Just"] }
-   , test "SymbolTest25" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.with = ["Nothing", "Just"] }
-   , test "SymbolTest26" $ A.defaultArgs { A.moduleName = "Foo", A.symbolName = "bar" }
-   , test "SymbolTest27" $ A.defaultArgs { A.moduleName = "Ugah.Blub", A.symbolName = "g" }
-   , test "SymbolTest28" $ A.defaultArgs { A.moduleName = "Ugah.Blub", A.symbolName = "d" }
-   , test_ "SymbolTest29" (C.defaultConfig { C.prettyPrint = prettyPrint }) (A.defaultArgs { A.moduleName = "X.Y", A.symbolName = "x" })
-   , test_ "SymbolTest30" (C.defaultConfig { C.prettyPrint = prettyPrint }) (A.defaultArgs { A.moduleName = "X.Y", A.symbolName = "x" })
-   , test "SymbolTest31" $ A.defaultArgs { A.moduleName = "Ugah.Blub", A.symbolName = "d" }
-   , test "SymbolTest32" $ A.defaultArgs { A.moduleName = "Control.Foo", A.symbolName = "foo" }
+   [ test "SymbolTest0" $ HI.defaultArgs { HI.moduleName = "Foo.Bar", HI.symbolName = "foo" }
+   , test "SymbolTest1" $ HI.defaultArgs { HI.moduleName = "Foo.Bar", HI.symbolName = "foo" }
+   , test "SymbolTest2" $ HI.defaultArgs { HI.moduleName = "Foo.Bar.Blub", HI.symbolName = "foo" }
+   , test "SymbolTest3" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.symbolName = "when" }
+   , test "SymbolTest4" $ HI.defaultArgs { HI.moduleName = "Ugah.Argh2", HI.symbolName = "argh" }
+   , test "SymbolTest5" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.symbolName = "when" }
+   , test "SymbolTest6" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.symbolName = "unless" }
+   , test "SymbolTest7" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.symbolName = "unless" }
+   , test "SymbolTest8" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.symbolName = "unless" }
+   , test "SymbolTest9" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.symbolName = "unless" }
+   , test "SymbolTest10" $ HI.defaultArgs { HI.moduleName = "Control.Applicative", HI.symbolName = "<$>" }
+   , test "SymbolTest11" $ HI.defaultArgs { HI.moduleName = "Control.Applicative", HI.symbolName = "<$>" }
+   , test "SymbolTest12" $ HI.defaultArgs { HI.moduleName = "Control.Applicative", HI.symbolName = "<$>" }
+   , test "SymbolTest13" $ HI.defaultArgs { HI.moduleName = "Control.Applicative", HI.symbolName = "<*" }
+   , test "SymbolTest14" $ HI.defaultArgs { HI.moduleName = "Control.Applicative", HI.symbolName = "<*" }
+   , test "SymbolTest15" $ HI.defaultArgs { HI.moduleName = "Control.Applicative", HI.symbolName = "*>" }
+   , test "SymbolTest16" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.symbolName = "when", HI.qualifiedName = "CM" }
+   , test "SymbolTest17" $ HI.defaultArgs { HI.moduleName = "Control.Monad", HI.symbolName = "when", HI.qualifiedName = "CM" }
+   , test "SymbolTest18" $ HI.defaultArgs { HI.moduleName = "Data.Text", HI.symbolName = "Text" }
+   , test "SymbolTest19" $ HI.defaultArgs { HI.moduleName = "Data.List", HI.symbolName = "foldl'" }
+   , test "SymbolTest20" $ HI.defaultArgs { HI.moduleName = "Data.Maybe", HI.symbolName = "Maybe", HI.all = True }
+   , test "SymbolTest21" $ HI.defaultArgs { HI.moduleName = "Data.Maybe", HI.symbolName = "Maybe", HI.all = True }
+   , test "SymbolTest22" $ HI.defaultArgs { HI.moduleName = "Data.Maybe", HI.symbolName = "Maybe", HI.with = ["Just"] }
+   , test "SymbolTest23" $ HI.defaultArgs { HI.moduleName = "Data.Maybe", HI.symbolName = "Maybe", HI.all = True, HI.with = ["Just"] }
+   , test "SymbolTest24" $ HI.defaultArgs { HI.moduleName = "Data.Maybe", HI.symbolName = "Maybe", HI.with = ["Just"] }
+   , test "SymbolTest25" $ HI.defaultArgs { HI.moduleName = "Data.Maybe", HI.symbolName = "Maybe", HI.with = ["Nothing", "Just"] }
+   , test "SymbolTest26" $ HI.defaultArgs { HI.moduleName = "Foo", HI.symbolName = "bar" }
+   , test "SymbolTest27" $ HI.defaultArgs { HI.moduleName = "Ugah.Blub", HI.symbolName = "g" }
+   , test "SymbolTest28" $ HI.defaultArgs { HI.moduleName = "Ugah.Blub", HI.symbolName = "d" }
+   , test_ "SymbolTest29" (HI.defaultConfig { HI.prettyPrint = prettyPrint }) (HI.defaultArgs { HI.moduleName = "X.Y", HI.symbolName = "x" })
+   , test_ "SymbolTest30" (HI.defaultConfig { HI.prettyPrint = prettyPrint }) (HI.defaultArgs { HI.moduleName = "X.Y", HI.symbolName = "x" })
+   , test "SymbolTest31" $ HI.defaultArgs { HI.moduleName = "Ugah.Blub", HI.symbolName = "d" }
+   , test "SymbolTest32" $ HI.defaultArgs { HI.moduleName = "Control.Foo", HI.symbolName = "foo" }
    ]
 
 
-test :: String -> A.HsImportArgs -> TestTree
-test testName args = test_ testName C.defaultConfig args
+test :: String -> HI.HsImportArgs -> TestTree
+test testName args = test_ testName HI.defaultConfig args
 
 
-test_ :: String -> C.Config -> A.HsImportArgs -> TestTree
+test_ :: String -> HI.Config -> HI.HsImportArgs -> TestTree
 test_ testName config args =
    goldenVsFileDiff testName diff goldenFile outputFile command
    where
       command = do
-         spec <- hsImportSpec (args { A.inputSrcFile = inputFile, A.outputSrcFile = outputFile })
-         case spec of
-              Left error  -> hPutStrLn stderr ("hsimport: " ++ error)
-              Right spec_ -> hsimport_ config spec_
+         maybeErr <- HI.hsimportWithArgs config (args { HI.inputSrcFile = inputFile, HI.outputSrcFile = outputFile })
+         case maybeErr of
+              Just err -> hPutStrLn stderr ("hsimport: " ++ err)
+              _        -> return ()
 
       diff ref new = ["diff", "-u", ref, new]
 
@@ -126,21 +123,21 @@
 prettyPrint _ = "Uupps"
 
 
-importPosAfterLast :: HS.ImportDecl -> [HS.ImportDecl] -> Maybe P.ImportPos
+importPosAfterLast :: HS.ImportDecl -> [HS.ImportDecl] -> Maybe HI.ImportPos
 importPosAfterLast _ []      = Nothing
-importPosAfterLast _ imports = Just . P.After . last $ imports
+importPosAfterLast _ imports = Just . HI.After . last $ imports
 
 
-importPosBeforeLast :: HS.ImportDecl -> [HS.ImportDecl] -> Maybe P.ImportPos
+importPosBeforeLast :: HS.ImportDecl -> [HS.ImportDecl] -> Maybe HI.ImportPos
 importPosBeforeLast _ []      = Nothing
-importPosBeforeLast _ imports = Just . P.Before . last $ imports
+importPosBeforeLast _ imports = Just . HI.Before . last $ imports
 
 
-importPosAfterFirst :: HS.ImportDecl -> [HS.ImportDecl] -> Maybe P.ImportPos
+importPosAfterFirst :: HS.ImportDecl -> [HS.ImportDecl] -> Maybe HI.ImportPos
 importPosAfterFirst _ []      = Nothing
-importPosAfterFirst _ imports = Just . P.After . head $ imports
+importPosAfterFirst _ imports = Just . HI.After . head $ imports
 
 
-importPosBeforeFirst :: HS.ImportDecl -> [HS.ImportDecl] -> Maybe P.ImportPos
+importPosBeforeFirst :: HS.ImportDecl -> [HS.ImportDecl] -> Maybe HI.ImportPos
 importPosBeforeFirst _ []      = Nothing
-importPosBeforeFirst _ imports = Just . P.Before . head $ imports
+importPosBeforeFirst _ imports = Just . HI.Before . head $ imports
diff --git a/tests/goldenFiles/ModuleTest31.hs b/tests/goldenFiles/ModuleTest31.hs
new file mode 100644
--- /dev/null
+++ b/tests/goldenFiles/ModuleTest31.hs
@@ -0,0 +1,19 @@
+{-# Language PatternGuards #-}
+module Blub
+   ( blub
+   , foo
+   , bar
+   ) where
+#include "Foo.h"
+import Ugah.Foo
+import Control.Applicative
+import Control.Monad as CM
+#ifdef FOO
+import Ugah.Blub
+#endif
+f :: Int -> Int
+f = (+ 3)
+
+g :: Int -> Int
+g =
+   where
diff --git a/tests/inputFiles/ModuleTest31.hs b/tests/inputFiles/ModuleTest31.hs
new file mode 100644
--- /dev/null
+++ b/tests/inputFiles/ModuleTest31.hs
@@ -0,0 +1,18 @@
+{-# Language PatternGuards #-}
+module Blub
+   ( blub
+   , foo
+   , bar
+   ) where
+#include "Foo.h"
+import Ugah.Foo
+import Control.Applicative
+#ifdef FOO
+import Ugah.Blub
+#endif
+f :: Int -> Int
+f = (+ 3)
+
+g :: Int -> Int
+g =
+   where
