diff --git a/llvm-general.cabal b/llvm-general.cabal
--- a/llvm-general.cabal
+++ b/llvm-general.cabal
@@ -1,5 +1,5 @@
 name: llvm-general
-version: 3.2.2.0
+version: 3.2.3.0
 license: BSD3
 license-file: LICENSE
 author: Benjamin S.Scarlet <fgthb0@greynode.net>
@@ -33,7 +33,7 @@
   type: git
   location: git://github.com/bscarlet/llvm-general.git
   branch: llvm-3.2
-  tag: v3.2.2.0
+  tag: v3.2.3.0
 
 flag shared-llvm
   description: link against llvm shared rather than static library
@@ -59,6 +59,13 @@
     setenv >= 0.1.0
   extra-libraries: stdc++
   hs-source-dirs: src
+  extensions:
+    TupleSections
+    DeriveDataTypeable
+    EmptyDataDecls
+    FlexibleContexts
+    FlexibleInstances
+    StandaloneDeriving
   exposed-modules:
     LLVM.General
     LLVM.General.AST
@@ -189,6 +196,10 @@
     containers >= 0.4.2.1,
     mtl >= 2.0.1.0
   hs-source-dirs: test
+  extensions:
+    TupleSections
+    FlexibleInstances
+    FlexibleContexts
   main-is: Test.hs
   other-modules:
     LLVM.General.Test.Constants
@@ -203,4 +214,3 @@
     LLVM.General.Test.Support
     LLVM.General.Test.Target
     LLVM.General.Test.Tests
-    
diff --git a/src/Control/Monad/AnyCont.hs b/src/Control/Monad/AnyCont.hs
--- a/src/Control/Monad/AnyCont.hs
+++ b/src/Control/Monad/AnyCont.hs
@@ -1,5 +1,4 @@
 {-# LANGUAGE
-  FlexibleInstances,
   MultiParamTypeClasses,
   UndecidableInstances
   #-}
diff --git a/src/Control/Monad/AnyCont/Class.hs b/src/Control/Monad/AnyCont/Class.hs
--- a/src/Control/Monad/AnyCont/Class.hs
+++ b/src/Control/Monad/AnyCont/Class.hs
@@ -1,7 +1,6 @@
 {-# LANGUAGE
   RankNTypes,
   MultiParamTypeClasses,
-  FlexibleInstances,
   UndecidableInstances
   #-}
 module Control.Monad.AnyCont.Class where
diff --git a/src/LLVM/General/AST/CallingConvention.hs b/src/LLVM/General/AST/CallingConvention.hs
--- a/src/LLVM/General/AST/CallingConvention.hs
+++ b/src/LLVM/General/AST/CallingConvention.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable
-  #-}
 -- | Module to allow importing 'CallingConvention' distinctly qualified.
 module LLVM.General.AST.CallingConvention where
 
diff --git a/src/LLVM/General/AST/FloatingPointPredicate.hs b/src/LLVM/General/AST/FloatingPointPredicate.hs
--- a/src/LLVM/General/AST/FloatingPointPredicate.hs
+++ b/src/LLVM/General/AST/FloatingPointPredicate.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable 
-  #-}  
 -- | Predicates for the 'LLVM.General.AST.Instruction.FCmp' instruction
 module LLVM.General.AST.FloatingPointPredicate where
 
diff --git a/src/LLVM/General/AST/InlineAssembly.hs b/src/LLVM/General/AST/InlineAssembly.hs
--- a/src/LLVM/General/AST/InlineAssembly.hs
+++ b/src/LLVM/General/AST/InlineAssembly.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable
-  #-}
 -- | A representation of an LLVM inline assembly
 module LLVM.General.AST.InlineAssembly where
 
diff --git a/src/LLVM/General/AST/Instruction.hs b/src/LLVM/General/AST/Instruction.hs
--- a/src/LLVM/General/AST/Instruction.hs
+++ b/src/LLVM/General/AST/Instruction.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable
-  #-}
 -- | LLVM instructions 
 -- <http://llvm.org/docs/LangRef.html#instruction-reference>
 module LLVM.General.AST.Instruction where
diff --git a/src/LLVM/General/AST/IntegerPredicate.hs b/src/LLVM/General/AST/IntegerPredicate.hs
--- a/src/LLVM/General/AST/IntegerPredicate.hs
+++ b/src/LLVM/General/AST/IntegerPredicate.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable 
-  #-}  
 -- | Predicates for the 'LLVM.General.AST.Instruction.ICmp' instruction
 module LLVM.General.AST.IntegerPredicate where
 
diff --git a/src/LLVM/General/AST/Linkage.hs b/src/LLVM/General/AST/Linkage.hs
--- a/src/LLVM/General/AST/Linkage.hs
+++ b/src/LLVM/General/AST/Linkage.hs
@@ -1,7 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable
-  #-}
-  
 -- | Module to allow importing 'Linkage' distinctly qualified.
 module LLVM.General.AST.Linkage where
 
diff --git a/src/LLVM/General/AST/RMWOperation.hs b/src/LLVM/General/AST/RMWOperation.hs
--- a/src/LLVM/General/AST/RMWOperation.hs
+++ b/src/LLVM/General/AST/RMWOperation.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable 
-  #-}  
 -- | Operations for the 'LLVM.General.AST.Instruction.AtomicRMW' instruction
 module LLVM.General.AST.RMWOperation where
 
diff --git a/src/LLVM/General/AST/Visibility.hs b/src/LLVM/General/AST/Visibility.hs
--- a/src/LLVM/General/AST/Visibility.hs
+++ b/src/LLVM/General/AST/Visibility.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable
-  #-}
 -- | Module to allow importing 'Visibility' distinctly qualified.
 module LLVM.General.AST.Visibility where
 
diff --git a/src/LLVM/General/CodeGenOpt.hs b/src/LLVM/General/CodeGenOpt.hs
--- a/src/LLVM/General/CodeGenOpt.hs
+++ b/src/LLVM/General/CodeGenOpt.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable
-  #-}
 -- | Code generation options, used in specifying TargetMachine
 module LLVM.General.CodeGenOpt where
 
diff --git a/src/LLVM/General/CodeModel.hs b/src/LLVM/General/CodeModel.hs
--- a/src/LLVM/General/CodeModel.hs
+++ b/src/LLVM/General/CodeModel.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable
-  #-}
 -- | Relocations, used in specifying TargetMachine
 module LLVM.General.CodeModel where
 
diff --git a/src/LLVM/General/Diagnostic.hs b/src/LLVM/General/Diagnostic.hs
--- a/src/LLVM/General/Diagnostic.hs
+++ b/src/LLVM/General/Diagnostic.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable
-  #-}
 -- | Diagnostics describe parse errors
 module LLVM.General.Diagnostic (
   DiagnosticKind(..),
diff --git a/src/LLVM/General/Internal/Atomicity.hs b/src/LLVM/General/Internal/Atomicity.hs
--- a/src/LLVM/General/Internal/Atomicity.hs
+++ b/src/LLVM/General/Internal/Atomicity.hs
@@ -1,9 +1,7 @@
 {-# LANGUAGE
   TemplateHaskell,
-  MultiParamTypeClasses,
-  FlexibleInstances
+  MultiParamTypeClasses
   #-}
-
 module LLVM.General.Internal.Atomicity where
 
 import Control.Monad
diff --git a/src/LLVM/General/Internal/Attribute.hs b/src/LLVM/General/Internal/Attribute.hs
--- a/src/LLVM/General/Internal/Attribute.hs
+++ b/src/LLVM/General/Internal/Attribute.hs
@@ -1,10 +1,8 @@
 {-# LANGUAGE
   TemplateHaskell,
   MultiParamTypeClasses,
-  ConstraintKinds,
-  FlexibleInstances
+  ConstraintKinds
   #-}
-
 module LLVM.General.Internal.Attribute where
 
 import Language.Haskell.TH
diff --git a/src/LLVM/General/Internal/CallingConvention.hs b/src/LLVM/General/Internal/CallingConvention.hs
--- a/src/LLVM/General/Internal/CallingConvention.hs
+++ b/src/LLVM/General/Internal/CallingConvention.hs
@@ -1,8 +1,7 @@
 {-# LANGUAGE
   MultiParamTypeClasses,
   TemplateHaskell,
-  QuasiQuotes,
-  FlexibleInstances
+  QuasiQuotes
   #-}
 module LLVM.General.Internal.CallingConvention where
 
diff --git a/src/LLVM/General/Internal/Coding.hs b/src/LLVM/General/Internal/Coding.hs
--- a/src/LLVM/General/Internal/Coding.hs
+++ b/src/LLVM/General/Internal/Coding.hs
@@ -1,7 +1,5 @@
 {-# LANGUAGE
   TemplateHaskell,
-  FlexibleInstances,
-  FlexibleContexts,
   MultiParamTypeClasses,
   FunctionalDependencies,
   UndecidableInstances
diff --git a/src/LLVM/General/Internal/Constant.hs b/src/LLVM/General/Internal/Constant.hs
--- a/src/LLVM/General/Internal/Constant.hs
+++ b/src/LLVM/General/Internal/Constant.hs
@@ -1,10 +1,7 @@
 {-# LANGUAGE
   TemplateHaskell,
   QuasiQuotes,
-  TupleSections,
   MultiParamTypeClasses,
-  FlexibleInstances,
-  FlexibleContexts,
   ScopedTypeVariables
   #-}
 module LLVM.General.Internal.Constant where
diff --git a/src/LLVM/General/Internal/DecodeAST.hs b/src/LLVM/General/Internal/DecodeAST.hs
--- a/src/LLVM/General/Internal/DecodeAST.hs
+++ b/src/LLVM/General/Internal/DecodeAST.hs
@@ -1,8 +1,5 @@
 {-# LANGUAGE
   GeneralizedNewtypeDeriving,
-  FlexibleContexts,
-  FlexibleInstances,
-  TypeFamilies,
   MultiParamTypeClasses,
   UndecidableInstances
   #-}
diff --git a/src/LLVM/General/Internal/Diagnostic.hs b/src/LLVM/General/Internal/Diagnostic.hs
--- a/src/LLVM/General/Internal/Diagnostic.hs
+++ b/src/LLVM/General/Internal/Diagnostic.hs
@@ -1,8 +1,6 @@
 {-# LANGUAGE
   TemplateHaskell,
-  DeriveDataTypeable,
-  MultiParamTypeClasses,
-  FlexibleInstances
+  MultiParamTypeClasses
   #-}  
 module LLVM.General.Internal.Diagnostic where
 
diff --git a/src/LLVM/General/Internal/EncodeAST.hs b/src/LLVM/General/Internal/EncodeAST.hs
--- a/src/LLVM/General/Internal/EncodeAST.hs
+++ b/src/LLVM/General/Internal/EncodeAST.hs
@@ -1,11 +1,8 @@
 {-# LANGUAGE
   GeneralizedNewtypeDeriving,
-  FlexibleContexts,
-  FlexibleInstances,
   MultiParamTypeClasses,
   UndecidableInstances
   #-}
-
 module LLVM.General.Internal.EncodeAST where
 
 import Control.Exception
diff --git a/src/LLVM/General/Internal/ExecutionEngine.hs b/src/LLVM/General/Internal/ExecutionEngine.hs
--- a/src/LLVM/General/Internal/ExecutionEngine.hs
+++ b/src/LLVM/General/Internal/ExecutionEngine.hs
@@ -1,7 +1,6 @@
 {-# LANGUAGE
   MultiParamTypeClasses,
   FunctionalDependencies,
-  FlexibleInstances,
   RankNTypes
   #-}
 module LLVM.General.Internal.ExecutionEngine where
@@ -14,13 +13,12 @@
 
 import Data.Word
 import Foreign.Ptr
-import Foreign.C.String (CString)
 import Foreign.C.Types (CUInt)
-import Foreign.Marshal.Alloc (free)
 
 import qualified LLVM.General.Internal.FFI.PtrHierarchy as FFI
 import qualified LLVM.General.Internal.FFI.ExecutionEngine as FFI
 import qualified LLVM.General.Internal.FFI.Module as FFI
+import qualified LLVM.General.Internal.FFI.LLVMCTypes as FFI
 
 import LLVM.General.Internal.Module
 import LLVM.General.Internal.Context
@@ -60,7 +58,7 @@
 withExecutionEngine :: 
   Context ->
   Maybe (Ptr FFI.Module) -> 
-  (Ptr (Ptr FFI.ExecutionEngine) -> Ptr FFI.Module -> Ptr CString -> IO CUInt) ->
+  (Ptr (Ptr FFI.ExecutionEngine) -> Ptr FFI.Module -> Ptr FFI.MallocedCString -> IO CUInt) ->
   (Ptr FFI.ExecutionEngine -> IO a) ->
   IO a
 withExecutionEngine c m createEngine f = flip runAnyContT return $ do
@@ -71,9 +69,7 @@
                                    . withModuleFromAST c (A.Module "" Nothing Nothing []))
                         (return . Module) m
   r <- liftIO $ createEngine outExecutionEngine dummyModule outErrorCStringPtr
-  when (r /= 0) $ do
-    s <- anyContToM $ bracket (peek outErrorCStringPtr) free
-    fail =<< decodeM s
+  when (r /= 0) $ fail =<< decodeM outErrorCStringPtr
   executionEngine <- anyContToM $ bracket (peek outExecutionEngine) FFI.disposeExecutionEngine
   liftIO $ removeModule executionEngine dummyModule
   liftIO $ f executionEngine
diff --git a/src/LLVM/General/Internal/FFI/Assembly.hs b/src/LLVM/General/Internal/FFI/Assembly.hs
--- a/src/LLVM/General/Internal/FFI/Assembly.hs
+++ b/src/LLVM/General/Internal/FFI/Assembly.hs
@@ -8,6 +8,7 @@
 import LLVM.General.Internal.FFI.Context 
 import LLVM.General.Internal.FFI.Module
 import LLVM.General.Internal.FFI.SMDiagnostic
+import LLVM.General.Internal.FFI.LLVMCTypes
 
 import Foreign.C
 import Foreign.Ptr
@@ -18,7 +19,7 @@
 
 -- | LLVM's serializer to generate a string of llvm assembly from a module
 foreign import ccall unsafe "LLVM_General_GetModuleAssembly" getModuleAssembly ::
-    Ptr Module -> IO CString
+    Ptr Module -> IO MallocedCString
 
 
 
diff --git a/src/LLVM/General/Internal/FFI/BasicBlock.hs b/src/LLVM/General/Internal/FFI/BasicBlock.hs
--- a/src/LLVM/General/Internal/FFI/BasicBlock.hs
+++ b/src/LLVM/General/Internal/FFI/BasicBlock.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
-  EmptyDataDecls,
   MultiParamTypeClasses
   #-}
 
diff --git a/src/LLVM/General/Internal/FFI/BinaryOperator.hs b/src/LLVM/General/Internal/FFI/BinaryOperator.hs
--- a/src/LLVM/General/Internal/FFI/BinaryOperator.hs
+++ b/src/LLVM/General/Internal/FFI/BinaryOperator.hs
@@ -1,12 +1,9 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
-  EmptyDataDecls,
   MultiParamTypeClasses,
-  FlexibleInstances,
   UndecidableInstances,
   OverlappingInstances
   #-}
-
 -- | FFI functions for handling the LLVM BinaryOperator class
 module LLVM.General.Internal.FFI.BinaryOperator where
 
diff --git a/src/LLVM/General/Internal/FFI/Builder.hs b/src/LLVM/General/Internal/FFI/Builder.hs
--- a/src/LLVM/General/Internal/FFI/Builder.hs
+++ b/src/LLVM/General/Internal/FFI/Builder.hs
@@ -1,10 +1,8 @@
 {-#
   LANGUAGE
   ForeignFunctionInterface,
-  EmptyDataDecls,
   TemplateHaskell
   #-}
-
 -- | FFI glue for llvm::IRBuilder - llvm's IR construction state object
 module LLVM.General.Internal.FFI.Builder where
 
diff --git a/src/LLVM/General/Internal/FFI/Constant.hs b/src/LLVM/General/Internal/FFI/Constant.hs
--- a/src/LLVM/General/Internal/FFI/Constant.hs
+++ b/src/LLVM/General/Internal/FFI/Constant.hs
@@ -1,13 +1,10 @@
 {-# LANGUAGE
   TemplateHaskell,
   ForeignFunctionInterface,
-  EmptyDataDecls,
   MultiParamTypeClasses,
-  FlexibleInstances,
   UndecidableInstances,
   OverlappingInstances
   #-}
-
 -- | FFI functions for handling the LLVM Constant class
 module LLVM.General.Internal.FFI.Constant where
 
diff --git a/src/LLVM/General/Internal/FFI/Context.hs b/src/LLVM/General/Internal/FFI/Context.hs
--- a/src/LLVM/General/Internal/FFI/Context.hs
+++ b/src/LLVM/General/Internal/FFI/Context.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE
-  ForeignFunctionInterface,
-  EmptyDataDecls
+  ForeignFunctionInterface
   #-}
 
 -- | Functions for handling the LLVMContext class. In all other LLVM interfaces,
diff --git a/src/LLVM/General/Internal/FFI/ExecutionEngine.hs b/src/LLVM/General/Internal/FFI/ExecutionEngine.hs
--- a/src/LLVM/General/Internal/FFI/ExecutionEngine.hs
+++ b/src/LLVM/General/Internal/FFI/ExecutionEngine.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE
-  ForeignFunctionInterface,
-  EmptyDataDecls
+  ForeignFunctionInterface
   #-}
 
 module LLVM.General.Internal.FFI.ExecutionEngine where
@@ -9,18 +8,19 @@
 import Foreign.C
 
 import LLVM.General.Internal.FFI.PtrHierarchy
+import LLVM.General.Internal.FFI.LLVMCTypes
 import LLVM.General.Internal.FFI.Module
 
 data ExecutionEngine
 
 foreign import ccall unsafe "LLVMCreateExecutionEngineForModule" createExecutionEngineForModule ::
-  Ptr (Ptr ExecutionEngine) -> Ptr Module -> Ptr CString -> IO CUInt
+  Ptr (Ptr ExecutionEngine) -> Ptr Module -> Ptr MallocedCString -> IO CUInt
 
 foreign import ccall unsafe "LLVMCreateInterpreterForModule" createInterpreterForModule ::
-  Ptr (Ptr ExecutionEngine) -> Ptr Module -> Ptr CString -> IO CUInt
+  Ptr (Ptr ExecutionEngine) -> Ptr Module -> Ptr MallocedCString -> IO CUInt
 
 foreign import ccall unsafe "LLVMCreateJITCompilerForModule" createJITCompilerForModule ::
-  Ptr (Ptr ExecutionEngine) -> Ptr Module -> CUInt -> Ptr CString -> IO CUInt
+  Ptr (Ptr ExecutionEngine) -> Ptr Module -> CUInt -> Ptr MallocedCString -> IO CUInt
 
 foreign import ccall unsafe "LLVMDisposeExecutionEngine" disposeExecutionEngine ::
   Ptr ExecutionEngine -> IO ()
diff --git a/src/LLVM/General/Internal/FFI/Function.hs b/src/LLVM/General/Internal/FFI/Function.hs
--- a/src/LLVM/General/Internal/FFI/Function.hs
+++ b/src/LLVM/General/Internal/FFI/Function.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
-  EmptyDataDecls,
   MultiParamTypeClasses
   #-}
 
diff --git a/src/LLVM/General/Internal/FFI/GlobalAlias.hs b/src/LLVM/General/Internal/FFI/GlobalAlias.hs
--- a/src/LLVM/General/Internal/FFI/GlobalAlias.hs
+++ b/src/LLVM/General/Internal/FFI/GlobalAlias.hs
@@ -1,12 +1,9 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
-  EmptyDataDecls,
   MultiParamTypeClasses,
-  FlexibleInstances,
   UndecidableInstances,
   OverlappingInstances
   #-}
-
 -- | FFI functions for handling the LLVM GlobalAlias class
 module LLVM.General.Internal.FFI.GlobalAlias where
 
diff --git a/src/LLVM/General/Internal/FFI/GlobalValue.hs b/src/LLVM/General/Internal/FFI/GlobalValue.hs
--- a/src/LLVM/General/Internal/FFI/GlobalValue.hs
+++ b/src/LLVM/General/Internal/FFI/GlobalValue.hs
@@ -1,12 +1,9 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
-  EmptyDataDecls,
   MultiParamTypeClasses,
-  FlexibleInstances,
   UndecidableInstances,
   OverlappingInstances
   #-}
-
 -- | FFI functions for handling the LLVM GlobalValue class
 module LLVM.General.Internal.FFI.GlobalValue where
 
diff --git a/src/LLVM/General/Internal/FFI/GlobalVariable.hs b/src/LLVM/General/Internal/FFI/GlobalVariable.hs
--- a/src/LLVM/General/Internal/FFI/GlobalVariable.hs
+++ b/src/LLVM/General/Internal/FFI/GlobalVariable.hs
@@ -1,12 +1,9 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
-  EmptyDataDecls,
   MultiParamTypeClasses,
-  FlexibleInstances,
   UndecidableInstances,
   OverlappingInstances
   #-}
-
 -- | FFI functions for handling the LLVM GlobalVariable class
 module LLVM.General.Internal.FFI.GlobalVariable where
 
diff --git a/src/LLVM/General/Internal/FFI/Instruction.hs b/src/LLVM/General/Internal/FFI/Instruction.hs
--- a/src/LLVM/General/Internal/FFI/Instruction.hs
+++ b/src/LLVM/General/Internal/FFI/Instruction.hs
@@ -1,13 +1,10 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
-  EmptyDataDecls,
   MultiParamTypeClasses,
-  FlexibleInstances,
   UndecidableInstances,
   OverlappingInstances,
   TemplateHaskell
   #-}
-
 module LLVM.General.Internal.FFI.Instruction where
 
 import Control.Monad
diff --git a/src/LLVM/General/Internal/FFI/InstructionDefs.hsc b/src/LLVM/General/Internal/FFI/InstructionDefs.hsc
--- a/src/LLVM/General/Internal/FFI/InstructionDefs.hsc
+++ b/src/LLVM/General/Internal/FFI/InstructionDefs.hsc
@@ -1,4 +1,3 @@
-{-# LANGUAGE DeriveDataTypeable #-}
 -- This module translates the instruction data in "llvm/Instruction.def" into a Haskell data structure,
 -- so it may be accessed conveniently with Template Haskell code
 module LLVM.General.Internal.FFI.InstructionDefs where
diff --git a/src/LLVM/General/Internal/FFI/LLVMCTypes.hsc b/src/LLVM/General/Internal/FFI/LLVMCTypes.hsc
--- a/src/LLVM/General/Internal/FFI/LLVMCTypes.hsc
+++ b/src/LLVM/General/Internal/FFI/LLVMCTypes.hsc
@@ -1,6 +1,4 @@
 {-# LANGUAGE
-  DeriveDataTypeable,
-  StandaloneDeriving,
   GeneralizedNewtypeDeriving
   #-}
 -- | Define types which correspond cleanly with some simple types on the C/C++ side.
@@ -51,6 +49,9 @@
 deriving instance Data CUInt
 
 newtype LLVMBool = LLVMBool CUInt
+
+newtype MallocedCString = MallocedCString CString
+  deriving (Storable)
 
 newtype CPPOpcode = CPPOpcode CUInt
   deriving (Eq, Ord, Show, Typeable, Data)
diff --git a/src/LLVM/General/Internal/FFI/Module.hs b/src/LLVM/General/Internal/FFI/Module.hs
--- a/src/LLVM/General/Internal/FFI/Module.hs
+++ b/src/LLVM/General/Internal/FFI/Module.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE
-  ForeignFunctionInterface,
-  EmptyDataDecls
+  ForeignFunctionInterface
   #-}
 module LLVM.General.Internal.FFI.Module where
 
@@ -36,7 +35,7 @@
   Ptr Module -> CString -> IO ()
 
 foreign import ccall unsafe "LLVM_General_GetModuleIdentifier" getModuleIdentifier ::
-  Ptr Module -> IO CString
+  Ptr Module -> IO MallocedCString
 
 foreign import ccall unsafe "LLVMGetFirstGlobal" getFirstGlobal ::
   Ptr Module -> IO (Ptr GlobalVariable)
@@ -89,4 +88,4 @@
   Ptr Module -> IO (ModuleAsm CString)
 
 foreign import ccall unsafe "LLVM_General_WriteBitcodeToFile" writeBitcodeToFile ::
-  Ptr Module -> CString -> Ptr CString -> IO LLVMBool
+  Ptr Module -> CString -> Ptr MallocedCString -> IO LLVMBool
diff --git a/src/LLVM/General/Internal/FFI/PassManager.hs b/src/LLVM/General/Internal/FFI/PassManager.hs
--- a/src/LLVM/General/Internal/FFI/PassManager.hs
+++ b/src/LLVM/General/Internal/FFI/PassManager.hs
@@ -1,7 +1,6 @@
 {-# LANGUAGE
   TemplateHaskell,
-  ForeignFunctionInterface,
-  EmptyDataDecls
+  ForeignFunctionInterface
   #-}
 
 module LLVM.General.Internal.FFI.PassManager where
diff --git a/src/LLVM/General/Internal/FFI/PtrHierarchy.hs b/src/LLVM/General/Internal/FFI/PtrHierarchy.hs
--- a/src/LLVM/General/Internal/FFI/PtrHierarchy.hs
+++ b/src/LLVM/General/Internal/FFI/PtrHierarchy.hs
@@ -1,13 +1,10 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
   MultiParamTypeClasses,
-  EmptyDataDecls,
   FunctionalDependencies,
-  FlexibleInstances,
   UndecidableInstances,
   OverlappingInstances
   #-}
-
 -- | This module defines typeclasses to represent the relationships of an object-oriented inheritance hierarchy
 module LLVM.General.Internal.FFI.PtrHierarchy where
 
diff --git a/src/LLVM/General/Internal/FFI/SMDiagnostic.hs b/src/LLVM/General/Internal/FFI/SMDiagnostic.hs
--- a/src/LLVM/General/Internal/FFI/SMDiagnostic.hs
+++ b/src/LLVM/General/Internal/FFI/SMDiagnostic.hs
@@ -1,8 +1,6 @@
 {-# LANGUAGE
-  ForeignFunctionInterface,
-  EmptyDataDecls
+  ForeignFunctionInterface
   #-}
-
 -- | FFI functions for handling the LLVM SMDiagnostic class
 module LLVM.General.Internal.FFI.SMDiagnostic where
 
diff --git a/src/LLVM/General/Internal/FFI/Target.hs b/src/LLVM/General/Internal/FFI/Target.hs
--- a/src/LLVM/General/Internal/FFI/Target.hs
+++ b/src/LLVM/General/Internal/FFI/Target.hs
@@ -1,7 +1,6 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
-  GeneralizedNewtypeDeriving,
-  EmptyDataDecls
+  GeneralizedNewtypeDeriving
   #-}
 module LLVM.General.Internal.FFI.Target where
 
@@ -17,7 +16,7 @@
     IO LLVMBool
 
 foreign import ccall unsafe "LLVM_General_LookupTarget" lookupTarget ::
-    CString -> CString -> Ptr CString -> Ptr CString -> IO (Ptr Target)
+    CString -> CString -> Ptr MallocedCString -> Ptr MallocedCString -> IO (Ptr Target)
 
 data TargetOptions
 
@@ -80,10 +79,23 @@
   Ptr TargetMachine -> IO ()
 
 foreign import ccall unsafe "LLVMTargetMachineEmitToFile" targetMachineEmitToFile ::
-  Ptr TargetMachine -> Ptr Module -> CString -> CodeGenFileType -> Ptr CString -> IO LLVMBool
+  Ptr TargetMachine -> Ptr Module -> CString -> CodeGenFileType -> Ptr MallocedCString -> IO LLVMBool
 
 data TargetLowering
 
 foreign import ccall unsafe "LLVM_General_GetTargetLowering" getTargetLowering ::
   Ptr TargetMachine -> IO (Ptr TargetLowering)
 
+foreign import ccall unsafe "LLVM_General_GetDefaultTargetTriple" getDefaultTargetTriple :: 
+  IO MallocedCString
+
+foreign import ccall unsafe "LLVM_General_GetHostCPUName" getHostCPUName :: 
+  IO MallocedCString
+
+foreign import ccall unsafe "LLVM_General_GetHostCPUFeatures" getHostCPUFeatures :: 
+  IO MallocedCString
+
+foreign import ccall unsafe "LLVM_General_GetTargetMachineDataLayout" getTargetMachineDataLayout ::
+  Ptr TargetMachine -> IO MallocedCString
+
+foreign import ccall unsafe "LLVM_General_InitializeAllTargets" initializeAllTargets :: IO ()
diff --git a/src/LLVM/General/Internal/FFI/TargetC.cpp b/src/LLVM/General/Internal/FFI/TargetC.cpp
--- a/src/LLVM/General/Internal/FFI/TargetC.cpp
+++ b/src/LLVM/General/Internal/FFI/TargetC.cpp
@@ -1,8 +1,11 @@
 #define __STDC_LIMIT_MACROS
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetSelect.h"
+#include "llvm/Support/Host.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/ADT/Triple.h"
 #include "llvm/ExecutionEngine/Interpreter.h"
+#include "llvm/DataLayout.h"
 #include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
 #include "llvm-c/Core.h"
@@ -198,5 +201,37 @@
 	return unwrap(t)->getTargetLowering();
 }
 
+char *LLVM_General_GetDefaultTargetTriple() {
+	return strdup(sys::getDefaultTargetTriple().c_str());
 }
 
+char *LLVM_General_GetHostCPUName() {
+	return strdup(sys::getHostCPUName().c_str());
+}
+
+char *LLVM_General_GetHostCPUFeatures() {
+	StringMap<bool> featureMap;
+	std::string features;
+	if (sys::getHostCPUFeatures(featureMap)) {
+		for(llvm::StringMap<bool>::const_iterator it = featureMap.begin(); it != featureMap.end(); ++it) {
+			if (it->second) {
+				features += it->first().str() + " ";
+			}
+		}
+	}
+	return strdup(features.c_str());
+}
+
+char *LLVM_General_GetTargetMachineDataLayout(LLVMTargetMachineRef t) {
+	return strdup(unwrap(t)->getDataLayout()->getStringRepresentation().c_str());
+}
+
+void LLVM_General_InitializeAllTargets() {
+	InitializeAllTargetInfos();
+	InitializeAllTargets();
+	InitializeAllTargetMCs();
+	InitializeAllAsmPrinters();
+	// None of the other components are bound yet
+}
+
+}
diff --git a/src/LLVM/General/Internal/FFI/Type.hs b/src/LLVM/General/Internal/FFI/Type.hs
--- a/src/LLVM/General/Internal/FFI/Type.hs
+++ b/src/LLVM/General/Internal/FFI/Type.hs
@@ -1,8 +1,6 @@
 {-# LANGUAGE
-  ForeignFunctionInterface,
-  EmptyDataDecls
+  ForeignFunctionInterface
   #-}
-
 -- | Functions for handling the LLVM types
 module LLVM.General.Internal.FFI.Type where
 
diff --git a/src/LLVM/General/Internal/FFI/User.hs b/src/LLVM/General/Internal/FFI/User.hs
--- a/src/LLVM/General/Internal/FFI/User.hs
+++ b/src/LLVM/General/Internal/FFI/User.hs
@@ -1,12 +1,9 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
-  EmptyDataDecls,
   MultiParamTypeClasses,
-  FlexibleInstances,
   UndecidableInstances,
   OverlappingInstances
   #-}
-
 -- | FFI functions for handling the LLVM User class
 module LLVM.General.Internal.FFI.User where
 
diff --git a/src/LLVM/General/Internal/FFI/Value.hs b/src/LLVM/General/Internal/FFI/Value.hs
--- a/src/LLVM/General/Internal/FFI/Value.hs
+++ b/src/LLVM/General/Internal/FFI/Value.hs
@@ -1,13 +1,9 @@
 {-# LANGUAGE
   ForeignFunctionInterface,
-  EmptyDataDecls,
   MultiParamTypeClasses,
-  FlexibleContexts,
-  FlexibleInstances,
   UndecidableInstances,
   OverlappingInstances
   #-}
-
 -- | FFI functions for handling the LLVM Value class
 module LLVM.General.Internal.FFI.Value where
 
diff --git a/src/LLVM/General/Internal/FloatingPointPredicate.hs b/src/LLVM/General/Internal/FloatingPointPredicate.hs
--- a/src/LLVM/General/Internal/FloatingPointPredicate.hs
+++ b/src/LLVM/General/Internal/FloatingPointPredicate.hs
@@ -1,9 +1,7 @@
 {-# LANGUAGE
   MultiParamTypeClasses,
-  TemplateHaskell,
-  FlexibleInstances
+  TemplateHaskell
   #-}
-
 module LLVM.General.Internal.FloatingPointPredicate where
 
 import LLVM.General.Internal.Coding
diff --git a/src/LLVM/General/Internal/Global.hs b/src/LLVM/General/Internal/Global.hs
--- a/src/LLVM/General/Internal/Global.hs
+++ b/src/LLVM/General/Internal/Global.hs
@@ -1,8 +1,6 @@
 {-# LANGUAGE
   TemplateHaskell,
-  FlexibleInstances,
-  MultiParamTypeClasses,
-  FlexibleContexts
+  MultiParamTypeClasses
   #-}
 module LLVM.General.Internal.Global where
 
diff --git a/src/LLVM/General/Internal/InlineAssembly.hs b/src/LLVM/General/Internal/InlineAssembly.hs
--- a/src/LLVM/General/Internal/InlineAssembly.hs
+++ b/src/LLVM/General/Internal/InlineAssembly.hs
@@ -1,7 +1,6 @@
 {-# LANGUAGE
   TemplateHaskell,
-  MultiParamTypeClasses,
-  FlexibleInstances
+  MultiParamTypeClasses
   #-}
 module LLVM.General.Internal.InlineAssembly where
  
diff --git a/src/LLVM/General/Internal/Instruction.hs b/src/LLVM/General/Internal/Instruction.hs
--- a/src/LLVM/General/Internal/Instruction.hs
+++ b/src/LLVM/General/Internal/Instruction.hs
@@ -1,10 +1,7 @@
 {-# LANGUAGE 
   TemplateHaskell,
   QuasiQuotes,
-  TupleSections,
   MultiParamTypeClasses,
-  FlexibleContexts,
-  FlexibleInstances,
   UndecidableInstances
   #-}
 module LLVM.General.Internal.Instruction where
diff --git a/src/LLVM/General/Internal/IntegerPredicate.hs b/src/LLVM/General/Internal/IntegerPredicate.hs
--- a/src/LLVM/General/Internal/IntegerPredicate.hs
+++ b/src/LLVM/General/Internal/IntegerPredicate.hs
@@ -1,9 +1,7 @@
 {-# LANGUAGE
   TemplateHaskell,
-  MultiParamTypeClasses,
-  FlexibleInstances
+  MultiParamTypeClasses
   #-}
-
 module LLVM.General.Internal.IntegerPredicate where
 
 import LLVM.General.Internal.Coding
diff --git a/src/LLVM/General/Internal/Metadata.hs b/src/LLVM/General/Internal/Metadata.hs
--- a/src/LLVM/General/Internal/Metadata.hs
+++ b/src/LLVM/General/Internal/Metadata.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE
-  MultiParamTypeClasses,
-  FlexibleInstances
+  MultiParamTypeClasses
   #-}
 module LLVM.General.Internal.Metadata where
 
diff --git a/src/LLVM/General/Internal/Module.hs b/src/LLVM/General/Internal/Module.hs
--- a/src/LLVM/General/Internal/Module.hs
+++ b/src/LLVM/General/Internal/Module.hs
@@ -1,8 +1,6 @@
 {-#
   LANGUAGE
-  TupleSections,
-  ScopedTypeVariables,
-  FlexibleInstances
+  ScopedTypeVariables
   #-}
 -- | This Haskell module is for/of functions for handling LLVM modules.
 module LLVM.General.Internal.Module where
@@ -15,7 +13,6 @@
 import Control.Exception
 
 import Foreign.Ptr
-import Foreign.Marshal.Alloc (free)
 
 import qualified LLVM.General.Internal.FFI.Assembly as FFI
 import qualified LLVM.General.Internal.FFI.Builder as FFI
@@ -71,7 +68,7 @@
 
 -- | generate LLVM assembly from a 'Module'
 moduleString :: Module -> IO String
-moduleString (Module m) = bracket (FFI.getModuleAssembly m) free $ decodeM
+moduleString (Module m) = decodeM =<< FFI.getModuleAssembly m
 
 -- | generate LLVM bitcode from a 'Module'
 writeBitcodeToFile :: FilePath -> Module -> ErrorT String IO ()
@@ -79,14 +76,14 @@
   msgPtr <- alloca
   path <- encodeM path
   result <- decodeM =<< (liftIO $ FFI.writeBitcodeToFile m path msgPtr)
-  when result $ fail =<< (decodeM =<< (anyContToM $ bracket (peek msgPtr) free))
+  when result $ fail =<< decodeM msgPtr
 
 emitToFile :: FFI.CodeGenFileType -> TargetMachine -> FilePath -> Module -> ErrorT String IO ()
 emitToFile fileType (TargetMachine tm) path (Module m) = flip runAnyContT return $ do
   msgPtr <- alloca
   path <- encodeM path
   result <- decodeM =<< (liftIO $ FFI.targetMachineEmitToFile tm m path fileType msgPtr)
-  when result $ fail =<< decodeM =<< anyContToM (bracket (peek msgPtr) free)
+  when result $ fail =<< decodeM msgPtr
 
 -- | write target-specific assembly directly into a file
 writeAssemblyToFile :: TargetMachine -> FilePath -> Module -> ErrorT String IO ()
@@ -237,7 +234,7 @@
   c <- return Context `ap` liftIO (FFI.getModuleContext mod)
   getMetadataKindNames c
   return A.Module 
-   `ap` (liftIO $ bracket (FFI.getModuleIdentifier mod) free decodeM)
+   `ap` (liftIO $ decodeM =<< FFI.getModuleIdentifier mod)
    `ap` (liftIO $ getDataLayout mod)
    `ap` (liftIO $ do
            s <- decodeM <=< FFI.getTargetTriple $ mod
diff --git a/src/LLVM/General/Internal/Operand.hs b/src/LLVM/General/Internal/Operand.hs
--- a/src/LLVM/General/Internal/Operand.hs
+++ b/src/LLVM/General/Internal/Operand.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE
-  MultiParamTypeClasses,
-  FlexibleInstances
+  MultiParamTypeClasses
   #-}
 module LLVM.General.Internal.Operand where
 
diff --git a/src/LLVM/General/Internal/PassManager.hs b/src/LLVM/General/Internal/PassManager.hs
--- a/src/LLVM/General/Internal/PassManager.hs
+++ b/src/LLVM/General/Internal/PassManager.hs
@@ -1,8 +1,6 @@
 {-# LANGUAGE
-  TemplateHaskell,
-  FlexibleInstances
+  TemplateHaskell
   #-}
-
 module LLVM.General.Internal.PassManager where
 
 import qualified Language.Haskell.TH as TH
diff --git a/src/LLVM/General/Internal/RMWOperation.hs b/src/LLVM/General/Internal/RMWOperation.hs
--- a/src/LLVM/General/Internal/RMWOperation.hs
+++ b/src/LLVM/General/Internal/RMWOperation.hs
@@ -1,9 +1,7 @@
 {-# LANGUAGE
   TemplateHaskell,
-  MultiParamTypeClasses,
-  FlexibleInstances
+  MultiParamTypeClasses
   #-}
-
 module LLVM.General.Internal.RMWOperation where
 
 import LLVM.General.AST.RMWOperation
diff --git a/src/LLVM/General/Internal/String.hs b/src/LLVM/General/Internal/String.hs
--- a/src/LLVM/General/Internal/String.hs
+++ b/src/LLVM/General/Internal/String.hs
@@ -1,19 +1,21 @@
 {-# LANGUAGE
   MultiParamTypeClasses,
-  FlexibleInstances,
   UndecidableInstances
   #-}
 module LLVM.General.Internal.String where
 
 import Control.Arrow
 import Control.Monad
-import Foreign.C (CString, CChar)
-import Foreign.Ptr
 import Control.Monad.AnyCont
 import Control.Monad.IO.Class
+import Control.Exception (finally)
+import Foreign.C (CString, CChar)
+import Foreign.Ptr
 import Foreign.Storable (Storable)
-import Foreign.Marshal.Alloc as F.M (alloca)
+import Foreign.Marshal.Alloc as F.M (alloca, free)
 
+import LLVM.General.Internal.FFI.LLVMCTypes
+
 import LLVM.General.Internal.Coding
 
 import qualified Data.ByteString as BS
@@ -37,6 +39,12 @@
 
 instance (MonadIO d) => DecodeM d String CString where
   decodeM = decodeM . UTF8ByteString <=< liftIO . BS.packCString
+
+instance (MonadIO d) => DecodeM d String MallocedCString where
+  decodeM (MallocedCString s) = liftIO $ finally (decodeM s) (free s)
+
+instance (MonadIO d) => DecodeM d String (Ptr MallocedCString) where
+  decodeM = liftIO . decodeM <=< peek
 
 instance (Integral i, MonadIO d) => DecodeM d String (Ptr CChar, i) where
   decodeM = decodeM . UTF8ByteString <=< liftIO . BS.packCStringLen . second fromIntegral
diff --git a/src/LLVM/General/Internal/Target.hs b/src/LLVM/General/Internal/Target.hs
--- a/src/LLVM/General/Internal/Target.hs
+++ b/src/LLVM/General/Internal/Target.hs
@@ -1,9 +1,8 @@
 {-# LANGUAGE
   TemplateHaskell,
-  FlexibleInstances,
   MultiParamTypeClasses,
-  TupleSections,
-  RecordWildCards
+  RecordWildCards,
+  UndecidableInstances
   #-}
 module LLVM.General.Internal.Target where
 
@@ -12,13 +11,19 @@
 import Control.Exception
 import Data.Functor
 import Control.Monad.AnyCont
+import Data.Maybe
 
 import Foreign.Ptr
-import Foreign.Marshal.Alloc (free)
+import Data.List (intercalate)
+import Data.Set (Set)
+import qualified Data.Set as Set
 
 import LLVM.General.Internal.Coding
 import LLVM.General.Internal.String ()
+import LLVM.General.Internal.DataLayout
 
+import LLVM.General.AST.DataLayout
+
 import qualified LLVM.General.Internal.FFI.LLVMCTypes as FFI
 import qualified LLVM.General.Internal.FFI.Target as FFI
 
@@ -62,10 +67,22 @@
   (FFI.fpOpFusionModeStrict, TO.FloatingPointOperationFusionStrict)
  ]
 
+-- | <http://llvm.org/doxygen/classllvm_1_1Target.html>
 newtype Target = Target (Ptr FFI.Target)
 
--- | Find a Target given an architecture and/or a \"triple\".
+-- | e.g. an instruction set extension
+newtype CPUFeature = CPUFeature String
+  deriving (Eq, Ord, Read, Show)
+
+instance EncodeM e String es => EncodeM e (Set CPUFeature) es where
+  encodeM = encodeM . intercalate " " . map (\(CPUFeature f) -> f) . Set.toList
+
+instance (Monad d, DecodeM d String es) => DecodeM d (Set CPUFeature) es where
+  decodeM = liftM (Set.fromList . map CPUFeature . words) . decodeM
+
+-- | Find a 'Target' given an architecture and/or a \"triple\".
 -- | <http://llvm.org/doxygen/structllvm_1_1TargetRegistry.html#a3105b45e546c9cc3cf78d0f2ec18ad89>
+-- | Be sure to run either 'initializeAllTargets' or 'initializeNativeTarget' before expecting this to succeed, depending on what target(s) you want to use.
 lookupTarget :: 
   Maybe String -- ^ arch
   -> String -- ^ \"triple\" - e.g. x86_64-unknown-linux-gnu
@@ -76,13 +93,8 @@
   arch <- encodeM (maybe "" id arch)
   triple <- encodeM triple
   target <- liftIO $ FFI.lookupTarget arch triple cNewTripleP cErrorP
-  let readString p = do
-        s <- peek p
-        r <- decodeM s
-        liftIO $ free s
-        return r
-  when (target == nullPtr) $ fail =<< readString cErrorP
-  liftM (Target target, ) $ readString cNewTripleP
+  when (target == nullPtr) $ fail =<< decodeM cErrorP
+  liftM (Target target, ) $ decodeM cNewTripleP
 
 -- | <http://llvm.org/doxygen/classllvm_1_1TargetOptions.html>
 newtype TargetOptions = TargetOptions (Ptr FFI.TargetOptions)
@@ -183,7 +195,7 @@
     Target
     -> String -- ^ triple
     -> String -- ^ cpu
-    -> String -- ^ features
+    -> Set CPUFeature -- ^ features
     -> TargetOptions
     -> Reloc.Model
     -> CodeModel.Model
@@ -226,7 +238,43 @@
 getTargetLowering :: TargetMachine -> IO TargetLowering
 getTargetLowering (TargetMachine tm) = TargetLowering <$> FFI.getTargetLowering tm
 
+-- | Initialize the native target. This function is called automatically in these Haskell bindings
+-- when creating an 'LLVM.General.ExecutionEngine.ExecutionEngine' which will require it, and so it should
+-- not be necessary to call it separately.
 initializeNativeTarget :: IO ()
 initializeNativeTarget = do
   failure <- decodeM =<< liftIO FFI.initializeNativeTarget
   when failure $ fail "native target initialization failed"
+
+-- | the default target triple that LLVM has been configured to produce code for
+getDefaultTargetTriple :: IO String
+getDefaultTargetTriple = decodeM =<< FFI.getDefaultTargetTriple
+
+-- | the LLVM name for the host CPU
+getHostCPUName :: IO String
+getHostCPUName = decodeM =<< FFI.getHostCPUName
+
+-- | a space-separated list of LLVM feature names supported by the host CPU
+getHostCPUFeatures :: IO (Set CPUFeature)
+getHostCPUFeatures = decodeM =<< FFI.getHostCPUFeatures
+  
+-- | 'DataLayout' to use for the given 'TargetMachine'
+getTargetMachineDataLayout :: TargetMachine -> IO DataLayout
+getTargetMachineDataLayout (TargetMachine m) =
+    fromMaybe (error "parseDataLayout failed") . parseDataLayout <$> (decodeM =<< (FFI.getTargetMachineDataLayout m))
+
+
+-- | Initialize all targets so they can be found by 'lookupTarget'
+initializeAllTargets :: IO ()
+initializeAllTargets = FFI.initializeAllTargets
+
+-- | Bracket creation and destruction of a TargetMachine configured for the host
+withDefaultTargetMachine :: (TargetMachine -> IO a) -> ErrorT String IO a
+withDefaultTargetMachine f = do
+  liftIO $ initializeAllTargets
+  triple <- liftIO $ getDefaultTargetTriple
+  cpu <- liftIO $ getHostCPUName
+  features <- liftIO $ getHostCPUFeatures
+  (target, _) <- lookupTarget Nothing triple
+  liftIO $ withTargetOptions $ \options ->
+      withTargetMachine target triple cpu features options Reloc.Default CodeModel.Default CodeGenOpt.Default f
diff --git a/src/LLVM/General/Internal/Type.hs b/src/LLVM/General/Internal/Type.hs
--- a/src/LLVM/General/Internal/Type.hs
+++ b/src/LLVM/General/Internal/Type.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE
   QuasiQuotes,
-  FlexibleInstances,
   MultiParamTypeClasses
   #-}
 module LLVM.General.Internal.Type where
diff --git a/src/LLVM/General/Internal/Value.hs b/src/LLVM/General/Internal/Value.hs
--- a/src/LLVM/General/Internal/Value.hs
+++ b/src/LLVM/General/Internal/Value.hs
@@ -1,6 +1,4 @@
 {-# LANGUAGE
-  FlexibleContexts,
-  FlexibleInstances,
   MultiParamTypeClasses
   #-}
 module LLVM.General.Internal.Value where
diff --git a/src/LLVM/General/Relocation.hs b/src/LLVM/General/Relocation.hs
--- a/src/LLVM/General/Relocation.hs
+++ b/src/LLVM/General/Relocation.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable
-  #-}
 -- | Relocations, used in specifying TargetMachine
 module LLVM.General.Relocation where
 
diff --git a/src/LLVM/General/Target.hs b/src/LLVM/General/Target.hs
--- a/src/LLVM/General/Target.hs
+++ b/src/LLVM/General/Target.hs
@@ -4,9 +4,13 @@
 module LLVM.General.Target (
    lookupTarget,
    TargetOptions,
+   TargetMachine,
+   CPUFeature(..),
    withTargetOptions, peekTargetOptions, pokeTargetOptions,
-   withTargetMachine,
-   getTargetLowering
+   withTargetMachine, withDefaultTargetMachine,
+   getTargetLowering,
+   getDefaultTargetTriple, getHostCPUName, getHostCPUFeatures,
+   getTargetMachineDataLayout, initializeNativeTarget, initializeAllTargets
  ) where
 
 import LLVM.General.Internal.Target
diff --git a/src/LLVM/General/Target/Options.hs b/src/LLVM/General/Target/Options.hs
--- a/src/LLVM/General/Target/Options.hs
+++ b/src/LLVM/General/Target/Options.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable 
-  #-}
 -- | <http://llvm.org/doxygen/classllvm_1_1TargetOptions.html>
 module LLVM.General.Target.Options where
 
diff --git a/src/LLVM/General/Transforms.hs b/src/LLVM/General/Transforms.hs
--- a/src/LLVM/General/Transforms.hs
+++ b/src/LLVM/General/Transforms.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE
-  DeriveDataTypeable
-  #-}
 -- | This module provides an enumeration of the various transformation (e.g. optimization) passes
 -- provided by LLVM. They can be used to create a 'LLVM.General.PassManager.PassManager' to, in turn,
 -- run the passes on 'LLVM.General.Module.Module's. If you don't know what passes you want, consider
diff --git a/test/LLVM/General/Test/ExecutionEngine.hs b/test/LLVM/General/Test/ExecutionEngine.hs
--- a/test/LLVM/General/Test/ExecutionEngine.hs
+++ b/test/LLVM/General/Test/ExecutionEngine.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE
-  ForeignFunctionInterface,
-  FlexibleContexts
+  ForeignFunctionInterface
   #-}
 module LLVM.General.Test.ExecutionEngine where
 
diff --git a/test/LLVM/General/Test/Module.hs b/test/LLVM/General/Test/Module.hs
--- a/test/LLVM/General/Test/Module.hs
+++ b/test/LLVM/General/Test/Module.hs
@@ -11,6 +11,8 @@
 import Data.Word
 import Data.Functor
 
+import qualified Data.Set as Set
+
 import LLVM.General.Context
 import LLVM.General.Module
 import LLVM.General.Diagnostic
diff --git a/test/LLVM/General/Test/Optimization.hs b/test/LLVM/General/Test/Optimization.hs
--- a/test/LLVM/General/Test/Optimization.hs
+++ b/test/LLVM/General/Test/Optimization.hs
@@ -7,6 +7,7 @@
 import LLVM.General.Test.Support
 
 import Data.Functor
+import qualified Data.Set as Set
 import qualified Data.Map as Map
 
 import LLVM.General.Module
@@ -293,7 +294,7 @@
         let triple = "x86_64-apple-darwin"
         (target, _) <- failInIO $ lookupTarget Nothing triple
         withTargetOptions $ \targetOptions -> do
-          withTargetMachine target triple "" "" targetOptions
+          withTargetMachine target triple "" Set.empty targetOptions
                             R.Default CM.Default CGO.Default $ \targetMachine -> do
             targetLowering <- getTargetLowering targetMachine
             withPassManager ([LowerInvoke False], targetLowering) $ \passManager -> do
diff --git a/test/LLVM/General/Test/Support.hs b/test/LLVM/General/Test/Support.hs
--- a/test/LLVM/General/Test/Support.hs
+++ b/test/LLVM/General/Test/Support.hs
@@ -1,7 +1,3 @@
-{-# LANGUAGE
-  TypeSynonymInstances,
-  FlexibleInstances
-  #-}
 module LLVM.General.Test.Support where
 
 import Test.Framework
