diff --git a/AUTHORS b/AUTHORS
new file mode 100644
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,7 @@
+Written by:
+        
+Jude Nagurney <jude@pwan.org>
+
+Contributions by:
+
+Gwern Branwen <gwen0@gmail.com>
diff --git a/HUnitAug.hs b/HUnitAug.hs
--- a/HUnitAug.hs
+++ b/HUnitAug.hs
@@ -27,11 +27,12 @@
 import Data.ByteString.Char8
 
 import Foreign
+import Foreign.C.Types
 import Foreign.ForeignPtr
 
-import Directory
+import System.Directory
 import Data.List (isInfixOf)
-import IO
+import System.IO as IO
 
 -- constants
 bs_BadPath = (Data.ByteString.Char8.pack "/files/bad/path")
@@ -47,6 +48,101 @@
                         Nothing -> assertFailure "aug_ptr shouldn't be nothing in with_augptr"
                         Just aug_fp -> (withForeignPtr aug_fp $ \aug_ptr -> func aug_ptr)
 
+-- ----------------
+-- aug_defvar tests
+-- ----------------
+testBadDefVar :: Test
+testBadDefVar = TestCase ( with_augptr $ \aug_ptr -> do
+                            ret_defvar <- aug_defvar aug_ptr (Data.ByteString.Char8.pack "var") (Just (Data.ByteString.Char8.pack "$undefined"))
+                            assertEqual "testBadDefVar " System.Augeas.error ret_defvar
+
+                            ret_error <- aug_error aug_ptr
+                            assertEqual "testBadDefVar error" err_bad_path ret_error
+
+                            )
+
+testGoodDefVar :: Test
+testGoodDefVar  = TestCase  ( with_augptr $ \aug_ptr -> do
+                                ret_defvar <- aug_defvar aug_ptr (Data.ByteString.Char8.pack "var") (Just (Data.ByteString.Char8.pack "/files/etc/hosts"))
+                                assertEqual "testGoodDefVar (1)" one ret_defvar
+
+                                ret_get <- aug_get aug_ptr (Data.ByteString.Char8.pack "$var/1/canonical")
+                                assertEqual "testGoodDefVar: Should have gotten localhost" (Right (Just "localhost")) ret_get
+                            )
+
+testReplaceDefVar :: Test 
+testReplaceDefVar  = TestCase ( with_augptr $ \aug_ptr -> do
+                                ret_defvar <- aug_defvar aug_ptr (Data.ByteString.Char8.pack "var") (Just (Data.ByteString.Char8.pack "/files/etc/hosts/1/canonical"))
+                                assertEqual "testReplaceDefVar" one ret_defvar
+
+                                ret_get <- aug_get aug_ptr (Data.ByteString.Char8.pack "$var")
+                                assertEqual "testReplaceDefVar: Should have gotten localhost" (Right (Just "localhost")) ret_get
+
+                                ret_defvar <- aug_defvar aug_ptr (Data.ByteString.Char8.pack "var") (Just (Data.ByteString.Char8.pack "/files/etc/hosts/1/ipaddr"))
+                                assertEqual "testReplaceDefVar (2)" one ret_defvar
+
+                                ret_get <- aug_get aug_ptr (Data.ByteString.Char8.pack "$var")
+                                assertEqual "testReplaceDefVar: Should have gotten 127.0.0.1" (Right (Just "127.0.0.1")) ret_get
+
+                            )
+
+testNullValueDefVar ::Test 
+testNullValueDefVar = TestCase ( with_augptr $ \aug_ptr -> do
+                                ret_defvar <- aug_defvar aug_ptr (Data.ByteString.Char8.pack "var") (Just (Data.ByteString.Char8.pack "/files/etc/hosts/1/canonical"))
+                                assertEqual "testNullDefVar (1)" one ret_defvar
+
+                                ret_get <- aug_get aug_ptr (Data.ByteString.Char8.pack "$var")
+                                assertEqual "testNullDefVar: Should have gotten localhost (1)" (Right (Just "localhost")) ret_get
+
+                                ret_defvar <- aug_defvar aug_ptr (Data.ByteString.Char8.pack "var") Nothing
+                                assertEqual "testNullDefVar (2)" success ret_defvar
+
+                                ret_get <- aug_get aug_ptr (Data.ByteString.Char8.pack "$var")
+                                assertEqual "testNullDefVar: Should have gotten localhost (2)" (Left invalid_match) ret_get
+
+                            )
+
+testNonZeroDefVar :: Test
+testNonZeroDefVar  = TestCase  ( with_augptr $ \aug_ptr -> do
+                                ret_defvar <- aug_defvar aug_ptr (Data.ByteString.Char8.pack "var") (Just (Data.ByteString.Char8.pack "/files/etc/hosts/*"))
+                                assertEqual "testGoodDefVar (1)" (AugRet 12) ret_defvar
+
+                            )
+
+-- -----------------
+-- aug_defnode tests
+-- -----------------
+
+testBadDefNode :: Test
+testBadDefNode = TestCase ( with_augptr $ \aug_ptr -> do
+                            ret_defnode <- aug_defnode aug_ptr (Data.ByteString.Char8.pack "var") (Data.ByteString.Char8.pack "$undefined") (Data.ByteString.Char8.pack "haskell-augeas.org")
+                            assertEqual "testBadDefNode" (System.Augeas.error, Nothing) ret_defnode
+
+                            ret_error <- aug_error aug_ptr
+                            assertEqual "testBadDefNode error" err_bad_path ret_error
+
+                            )
+
+testDefNode :: Test
+testDefNode = TestCase ( with_augptr $ \aug_ptr -> do
+                           ret_defvar <- aug_defnode aug_ptr (Data.ByteString.Char8.pack "var") (Data.ByteString.Char8.pack "/files/etc/hosts/1000/canonical") (Data.ByteString.Char8.pack "haskell-augeas.org")
+                           assertEqual "defnode (1)" ((AugRet 1),(Just True)) ret_defvar
+                           ret_get <- aug_get aug_ptr (Data.ByteString.Char8.pack "$var")
+                           assertEqual "defnode (2)" (Right (Just "haskell-augeas.org")) ret_get
+
+                           -- The node already exists, so it should not be set to the new value
+                           ret_defvar <- aug_defnode aug_ptr (Data.ByteString.Char8.pack "bar") (Data.ByteString.Char8.pack "/files/etc/hosts/1000/canonical") (Data.ByteString.Char8.pack "haskell-augeas2.org")
+                           assertEqual "defnode (3)" ((AugRet 1),(Just False)) ret_defvar
+                           ret_get <- aug_get aug_ptr (Data.ByteString.Char8.pack "$bar")
+                           assertEqual "defnode(4)" (Right (Just "haskell-augeas.org")) ret_get
+                        )
+
+--testNonZeroDefNode :: Test
+--testNonZeroDefNode = TestCase  ( with_augptr $ \aug_ptr -> do
+--                                ret_defnode <- aug_defnode aug_ptr (Data.ByteString.Char8.pack "var") (Data.ByteString.Char8.pack "/files/etc/hosts") (Data.ByteString.Char8.pack "unset")
+--                                assertEqual "testNonZeroDefVar (1)" ((AugRet 12),(Just False)) ret_defnode
+--                            )
+
 -- -------------
 -- aug_get tests
 -- -------------
@@ -85,12 +181,12 @@
 testGetMultipleLabel = TestCase ( with_augptr $ \aug_ptr -> do
                                   ret_get <- aug_get aug_ptr (Data.ByteString.Char8.pack "/files/etc/hosts/*/canonical")
                                   assertEqual "Get should return a negative on multiple matches" (Left invalid_match) ret_get
-                              )
+                             )
 
 testGetBadMultipleLabel :: Test
 testGetBadMultipleLabel = TestCase ( with_augptr $ \aug_ptr -> do
                                   ret_get <- aug_get aug_ptr (Data.ByteString.Char8.pack "/files/etc/hosts/*/invalid")
-                                  assertEqual "Get should return a negative on multiple matches" (Left invalid_match) ret_get
+                                  assertEqual "Get should return a negative on multiple matches (2)" (Left no_match) ret_get
                               )
 
 -- -------------
@@ -109,6 +205,10 @@
 testSetMultiMatch = TestCase ( with_augptr $ \aug_ptr -> do
                               ret_set <- aug_set aug_ptr (Data.ByteString.Char8.pack "/files/etc/hosts/*/canonical") (Data.ByteString.Char8.pack "haskell-augeas.org")
                               assertEqual "set OK" System.Augeas.error ret_set
+
+                              ret_error <- aug_error aug_ptr
+                              assertEqual "testSetMultiMatch error" no_error ret_error
+
                              )
 
 -- ----------------
@@ -118,12 +218,20 @@
 testInsertBadPath = TestCase ( with_augptr $ \aug_ptr -> do
                                ret_insert <- aug_insert aug_ptr bs_BadPath (Data.ByteString.Char8.pack "label") just_after
                                assertEqual "Bad path in insert" System.Augeas.error ret_insert
+
+                               ret_error <- aug_error aug_ptr
+                               assertEqual "testInsertBadPath error" err_no_match ret_error
+
                           )
 
 testInsertMultiMatch :: Test
 testInsertMultiMatch = TestCase ( with_augptr $ \aug_ptr -> do
                                     ret_insert <- aug_insert aug_ptr (Data.ByteString.Char8.pack "/files/etc/hosts/*/canonical") (Data.ByteString.Char8.pack "label") just_after
                                     assertEqual "No multimatches on insert" System.Augeas.error ret_insert
+
+                                    ret_error <- aug_error aug_ptr
+                                    assertEqual "testInsertMultiMatch error" err_multi_matches ret_error
+
                              )
 
 testInsertBeforeAfter :: Test
@@ -148,7 +256,7 @@
 testRmBadPath :: Test
 testRmBadPath = TestCase ( with_augptr $ \aug_ptr -> do
                                ret_rm <- aug_rm aug_ptr bs_BadPath
-                               assertEqual "Bad path in rm" 0 ret_rm
+                               assertEqual "Bad path in rm 1" 0 ret_rm
                          )
 
 testRmOne :: Test
@@ -179,6 +287,10 @@
 testMvBadSrc = TestCase ( with_augptr $ \aug_ptr -> do
                             ret_mv <- aug_mv aug_ptr bs_BadPath (Data.ByteString.Char8.pack "/files/etc/hosts/1/badpath")
                             assertEqual "mv bad src" System.Augeas.error ret_mv
+
+                            ret_error <- aug_error aug_ptr
+                            assertEqual "testMvBadSrc error" err_no_match ret_error
+
                         )
 
 testMvNewDest :: Test
@@ -244,20 +356,47 @@
                               contents <- Prelude.readFile (cwd++"/testroot/etc/hosts.augnew")
                               assertEqual "Check augnew" (Data.List.isInfixOf "192.168.1.234\thaskell-augeas.org" contents) True
 
+                              removeFile (cwd++"/testroot/etc/hosts.augnew")
+
                               ret_rm <- aug_rm aug_ptr (Data.ByteString.Char8.pack "/files/etc/hosts/1000")
-                              assertEqual "Bad path in rm" 3 ret_rm
+                              assertEqual "Bad path in rm 2" 3 ret_rm
 
                               ret_save <- aug_save aug_ptr 
                               assertEqual "save good" success ret_save
 
-                              contents <- Prelude.readFile (cwd++"/testroot/etc/hosts.augnew")
-                              assertEqual "Check augnew" (Data.List.isInfixOf "192.168.1.234\thaskell-augeas.org" contents) False
+                              -- removing the /file/etc/hosts/10 entry will put /etc/hosts  back to its original state, so nothing will be written out
+                              -- so the augnew file shouldn't  exist
+                              b_AugnewExists <- doesFileExist (cwd++"/testroot/etc/hosts.augnew")
+                              assertEqual "No augnew" b_AugnewExists False
                               
                             )
 
--- ---------
--- aug_print
--- ---------
+-- --------------
+-- aug_load tests
+-- --------------
+testLoad :: Test
+testLoad = TestCase ( with_augptr $ \aug_ptr -> do
+
+                        cwd <- getCurrentDirectory
+
+                        renameFile (cwd++"/testroot/etc/hosts") (cwd++"/testroot/etc/hosts.orig")
+                        renameFile (cwd++"/testroot/etc/hosts.reload") (cwd++"/testroot/etc/hosts")
+                    
+                        ret_load <- aug_load aug_ptr
+                        assertEqual  "testLoad (1)" success ret_load
+
+                        -- Verify the new entry was loaded
+                        ret_get <- aug_get aug_ptr (Data.ByteString.Char8.pack "/files/etc/hosts/10/ipaddr")
+                        assertEqual "testLoad (2)" (Right (Just "192.168.0.203")) ret_get
+
+                        renameFile (cwd++"/testroot/etc/hosts") (cwd++"/testroot/etc/hosts.reload")
+                        renameFile (cwd++"/testroot/etc/hosts.orig") (cwd++"/testroot/etc/hosts")
+
+                    )
+
+-- ---------------
+-- aug_print tests
+-- ---------------
 testPrint :: Test
 testPrint = TestCase ( with_augptr $ \aug_ptr -> do                         
                          cwd <- getCurrentDirectory
@@ -275,10 +414,69 @@
 
                      )
 
+-- ---------------
+-- aug_error tests
+-- ---------------
+testError ::  Test
+testError = TestCase ( with_augptr $ \aug_ptr -> do                         
+
+                         ret_err <- aug_error aug_ptr 
+                         assertEqual ("testError")  no_error ret_err
+                         
+
+                     )
+
+-- ----------------
+-- aug_error* tests
+-- ----------------
+testErrMessage :: Test
+testErrMessage = TestCase ( with_augptr $ \aug_ptr -> do
+                            ret_defvar <- aug_defvar aug_ptr (Data.ByteString.Char8.pack "var") (Just (Data.ByteString.Char8.pack "$undefined"))
+                            assertEqual "testErrMessage (1) " System.Augeas.error ret_defvar
+
+                            ret_error <- aug_error aug_ptr
+                            assertEqual "testErrMessage (2)" err_bad_path ret_error
+
+                            err_message <- aug_error_message aug_ptr
+                            assertEqual "testErrMessage (3)" (Data.ByteString.Char8.pack "Invalid path expression") err_message
+
+                            err_minor_message <- aug_error_minor_message aug_ptr
+                            assertEqual "testErrMessage (4)" (Data.ByteString.Char8.pack "undefined variable") err_minor_message
+
+                            err_details <- aug_error_details aug_ptr
+                            assertEqual "testErrMessage (4)" (Data.ByteString.Char8.pack "$undefined|=|") err_details
+
+
+                            )
+
+-- -----------------------
+-- aug_error_message tests
+-- -----------------------
+
+-- -----------------------------
+-- aug_error_minor_message tests
+-- -----------------------------
+
+-- -----------------
+-- aug_error_details
+-- -----------------
+
 main :: IO Counts
 main = runTestTT $ TestList [
         -- testBadRoot,
 
+        -- aug_defvar
+        testBadDefVar,
+        testGoodDefVar,
+        testReplaceDefVar,
+        testNullValueDefVar,
+        testNonZeroDefVar,
+        
+        -- auf_defnode
+        testBadDefNode,
+        testDefNode,
+--        testNonZeroDefNode,
+
         -- aug_get tests
         testGetBadPath,
         testGetPartialPath,
@@ -315,8 +513,18 @@
         testSave,
         testSaveNewLabel,
 
+        -- aug_load
+        testLoad,
+
         -- aug_print tests
-        testPrint
+        testPrint,
+
+        -- aug_error
+        -- aug_error_message
+        -- aug_error_minor_message
+        -- aug_error_details
+        testError,
+        testErrMessage
 
         -- aug_close already handled in ForeignPtr, so there's no need to surface it to Haskell users at all.
 
diff --git a/System/Augeas.hs b/System/Augeas.hs
--- a/System/Augeas.hs
+++ b/System/Augeas.hs
@@ -31,16 +31,21 @@
     (
     -- * Types
     Augeas
-    , AugFlag,
-    none, save_backup, save_newfile, type_check
+    , AugFlag(..)
+    , none, save_backup, save_newfile, type_check, no_stdinc, save_noop, no_load, no_modl_autoload
     , AugMatch
     , exactly_one, no_match, invalid_match
-    , AugRet
-    , success, System.Augeas.error
-    , AugBefore
+    , AugRet(..)
+    , success, one, System.Augeas.error
+    , AugBefore(..)
     , just_before, just_after
+    , AugErrCode(..)
+    , no_error,  err_no_memory, err_internal, err_bad_path, err_no_match, err_multi_matches, err_syntax, err_no_lens, err_multi_xfm
+               
     -- * Functions
     , aug_init
+    , aug_defvar
+    , aug_defnode
     , aug_get
     , aug_set
     , aug_insert
@@ -48,7 +53,12 @@
     , aug_mv
     , aug_match
     , aug_save
+    , aug_load
     , aug_print
+    , aug_error    
+    , aug_error_message        
+    , aug_error_minor_message
+    , aug_error_details
     ) where
 
 import System.IO
@@ -122,6 +132,9 @@
 error  :: AugRet
 error  = AugRet (-1)
 
+one :: AugRet
+one = AugRet 1
+
 -- ----------
 -- aug_before
 -- ----------
@@ -208,6 +221,95 @@
 --aug_close :: FinalizerPtr Augeas
 --aug_close =  c_aug_close 
 
+-- ----------
+-- aug_defvar
+-- ----------
+foreign import ccall unsafe "augeas.h aug_defvar"
+        c_aug_defvar :: Ptr Augeas                  -- aug
+                     -> CString                     -- name
+                     -> CString                     -- expr
+                     -> IO (AugRet)                 -- return_value
+{-|  
+  Function: aug_defvar
+  
+   Define a variable NAME whose value is the result of evaluating EXPR. If
+   a variable NAME already exists, its name will be replaced with the
+   result of evaluating EXPR.
+  
+   If EXPR is Nothing, the variable NAME will be removed if it is defined.
+  
+   Path variables can be used in path expressions later on by prefixing
+   them with '$'.
+  
+   Returns -1 on error; on success, returns 0 if EXPR evaluates to anything
+   other than a nodeset, and the number of nodes if EXPR evaluates to a
+   nodeset
+-}
+aug_defvar :: Ptr Augeas  -- ^ Augeas pointer
+           -> ByteString  -- ^ NAME
+           -> (Maybe ByteString)  -- ^ Maybe EXPR
+           -> IO (AugRet) -- ^ AugRet
+aug_defvar aug_ptr bstr1 (Just bstr2) = 
+           useAsCString bstr1 $ \name -> do
+             useAsCString bstr2 $ \expr -> do
+                ret <- c_aug_defvar aug_ptr name expr
+                return ret
+
+aug_defvar aug_ptr bstr1 Nothing = 
+           useAsCString bstr1 $ \name -> do
+             ret <- c_aug_defvar aug_ptr name nullPtr
+             return ret
+
+-- -----------
+-- aug_defnode
+-- -----------
+foreign import ccall unsafe "augeas.h aug_defnode"
+        c_aug_defnode :: Ptr Augeas                  -- aug
+                      -> CString                     -- name
+                      -> CString                     -- expr
+                      -> CString                     -- value
+                      -> Ptr CInt                    -- created
+                      -> IO (CInt)               -- return_value
+{-|  
+ Function: aug_defnode
+
+ Define a variable NAME whose value is the result of evaluating EXPR,
+ which must be non-NULL and evaluate to a nodeset. If a variable NAME
+ already exists, its name will be replaced with the result of evaluating
+ EXPR.
+ 
+ If EXPR evaluates to an empty nodeset, a node is created, equivalent to
+ calling AUG_SET(AUG, EXPR, VALUE) and NAME will be the nodeset containing
+ that single node.
+ 
+ If CREATED is non-NULL, it is set to 1 if a node was created, and 0 if
+ it already existed.
+ 
+ Returns -1 on error; on success, returns the number of nodes in the
+ nodeset 
+-}
+aug_defnode :: Ptr Augeas  -- ^ Augeas pointer
+            -> ByteString  -- ^ NAME
+            -> ByteString  -- ^ EXPR
+            -> ByteString  -- ^ VALUE
+        -> IO (AugRet,Maybe Bool) -- ^ (AugMatch,b_NodeCreated)
+aug_defnode aug_ptr bstr1 bstr2 bstr3 = 
+           useAsCString bstr1 $ \name -> do
+             useAsCString bstr2 $ \expr -> do
+               useAsCString bstr3 $ \value -> do
+                 alloca $ \created -> do
+                   ret <- c_aug_defnode aug_ptr name expr value created
+                   if ret /= -1 
+                      then do
+                        i_created <- peek created
+                        if i_created == 0 
+                           then do
+                             return ((AugRet ret), Just False)
+                           else do
+                             return ((AugRet ret), Just True)
+                      else do
+                        return ((AugRet ret), Nothing)
+
 -- -------
 -- aug_get 
 -- -------
@@ -215,13 +317,15 @@
         c_aug_get :: Ptr Augeas                  -- aug
                   -> CString                     -- path
                   -> Ptr CString                 -- value
-                  -> IO (AugMatch)               -- return_value
+                  -> IO (CInt)               -- return_value
 
 {-|  
   Lookup the value associated with PATH. VALUE can be NULL, in which case
   it is ignored. If VALUE is not NULL, it is used to return a pointer to
   the value associated with PATH if PATH matches exactly one node. If PATH
-  matches no nodes or more than one node, *VALUE is set to NULL.
+  matches no nodes or more than one node, *VALUE is set to NULL. Note that
+  it is perfectly legal for nodes to have a NULL value, and that that by 
+  itself does not indicate an error.
 
   Return AugMatch.exactly_one if there is exactly one node matching PATH, AugMatch.no_match if there is none,
   and AugMatch.invalid_match if there is more than one node matching PATH, or if
@@ -235,11 +339,11 @@
         useAsCString bstr1 $ \path -> do
           alloca $ \value -> do
             ret <- c_aug_get aug_ptr path value
-            if ret == exactly_one
+            if ret == 1
                then do 
                  if value == nullPtr 
                     then do
-                      return (Left ret)
+                      return (Left (AugMatch ret))
                     else do
                       peeked <- peek value
                       if peeked == nullPtr
@@ -249,7 +353,7 @@
                              str_peeked <- peekCString peeked
                              return (Right (Just str_peeked))
                else do                   
-                 return (Left ret)
+                 return (Left (AugMatch ret))
 
 -- -------
 -- aug_set
@@ -435,7 +539,7 @@
  Only files that had any changes made to them are written.
 
  If AUG_SAVE_NEWFILE is set in the FLAGS passed to AUG_INIT, create
- changed files as new files with the extension ".augnew", and leave teh
+ changed files as new files with the extension ".augnew", and leave the
  original file unmodified.
 
  Otherwise, if AUG_SAVE_BACKUP is set in the FLAGS passed to AUG_INIT,
@@ -451,7 +555,50 @@
                      ret <- c_aug_save aug_ptr
                      return ret
 
+-- --------
+-- aug_load
+-- --------
+foreign import ccall unsafe "augeas.h aug_load"
+        c_aug_load :: Ptr Augeas                -- aug
+                    -> IO (CInt)                 -- return value
+{-|
+ Function: aug_load
+ 
+ Load files into the tree. Which files to load and what lenses to use on
+ them is specified under /augeas/load in the tree; each entry
+ /augeas/load/NAME specifies a 'transform', by having itself exactly one
+ child 'lens' and any number of children labelled 'incl' and 'excl'. The
+ value of NAME has no meaning.
+ 
+ The 'lens' grandchild of /augeas/load specifies which lens to use, and
+ can either be the fully qualified name of a lens 'Module.lens' or
+ '@Module'. The latter form means that the lens from the transform marked
+ for autoloading in MODULE should be used.
+ 
+ The 'incl' and 'excl' grandchildren of /augeas/load indicate which files
+ to transform. Their value are used as glob patterns. Any file that
+ matches at least one 'incl' pattern and no 'excl' pattern is
+ transformed. The order of 'incl' and 'excl' entries is irrelevant.
+ 
+ When AUG_INIT is first called, it populates /augeas/load with the
+ transforms marked for autoloading in all the modules it finds.
+ 
+ Before loading any files, AUG_LOAD will remove everything underneath
+ /augeas/files and /files, regardless of whether any entries have been
+ modified or not.
+ 
+ Returns -1 on error, 0 on success. Note that success includes the case
+ where some files could not be loaded. Details of such files can be found
+ as '/augeas//error'.
 
+-}
+aug_load :: Ptr Augeas    -- ^ Augeas pointer
+         -> IO (AugRet)   -- ^ return value
+aug_load aug_ptr = 
+                   do 
+                     ret <- c_aug_load aug_ptr
+                     return (AugRet ret)
+
 -- ---------
 -- aug_print
 -- ---------
@@ -497,3 +644,76 @@
         fclose out
         return(ret)
 
+
+-- ---------
+-- aug_error
+-- ---------
+foreign import ccall unsafe "augeas.h aug_error"
+        c_aug_error :: Ptr Augeas               -- aug
+                    -> IO (AugErrCode)          -- error code
+
+{-|
+ Return a human-readable message for the error code */
+-}
+
+aug_error :: Ptr Augeas  -- ^ Augeas pointer
+          -> IO (AugErrCode) -- ^ return value
+aug_error aug_ptr = 
+    do 
+        ret <- c_aug_error aug_ptr
+        return(ret)
+
+-- -----------------
+-- aug_error_message
+-- -----------------
+foreign import ccall unsafe "augeas.h aug_error_message"
+        c_aug_error_message :: Ptr Augeas               -- aug
+                            -> IO (CString)             -- return value
+{-|
+ Return a human-readable message for the error code */
+-}
+aug_error_message :: Ptr Augeas  -- ^ Augeas pointer
+                  -> IO (ByteString) -- ^ return value
+aug_error_message aug_ptr = 
+    do 
+        cstr <- c_aug_error_message aug_ptr
+        ret <- packCString cstr
+        return(ret)
+
+-- -----------------------
+-- aug_error_minor_message
+-- -----------------------
+foreign import ccall unsafe "augeas.h aug_error_minor_message"
+        c_aug_error_minor_message :: Ptr Augeas               -- aug
+                                  -> IO (CString)             -- return value
+{-|
+ Return a human-readable message elaborating the error code; might be
+ NULL. For example, when the error code is AUG_EPATHX, this will explain
+ how the path expression is invalid */
+-}
+aug_error_minor_message :: Ptr Augeas  -- ^ Augeas pointer
+                        -> IO (ByteString) -- ^ return value
+aug_error_minor_message aug_ptr = 
+    do 
+        cstr <- c_aug_error_minor_message aug_ptr
+        ret <- packCString cstr
+        return(ret)
+
+-- -----------------
+-- aug_error_details
+-- -----------------
+foreign import ccall unsafe "augeas.h aug_error_details"
+        c_aug_error_details :: Ptr Augeas               -- aug
+                           -> IO (CString)             -- return value
+{-|
+ Return details about the error, which might be NULL. For example, for
+ AUG_EPATHX, indicates where in the path expression the error
+ occurred. The returned value can only be used until the next API call
+-}
+aug_error_details :: Ptr Augeas  -- ^ Augeas pointer
+                  -> IO (ByteString) -- ^ return value
+aug_error_details aug_ptr = 
+    do 
+        cstr <- c_aug_error_details aug_ptr
+        ret <- packCString cstr
+        return(ret)
diff --git a/System/AugeasHsc.hsc b/System/AugeasHsc.hsc
--- a/System/AugeasHsc.hsc
+++ b/System/AugeasHsc.hsc
@@ -40,6 +40,29 @@
        , save_backup = AUG_SAVE_BACKUP
        , save_newfile = AUG_SAVE_NEWFILE
        , type_check = AUG_TYPE_CHECK
+       , no_stdinc = AUG_NO_STDINC
+       , save_noop = AUG_SAVE_NOOP
+       , no_load = AUG_NO_LOAD
+       , no_modl_autoload = AUG_NO_MODL_AUTOLOAD
+}
+
+-- ---------------------------------
+-- Maps to auf_errcode_t in augeas.h
+-- ---------------------------------
+
+newtype AugErrCode = AugErrCode { unAugErrCode :: CInt }
+        deriving (Eq, Show)
+
+#{enum AugErrCode, AugErrCode
+       , no_error = AUG_NOERROR
+       , err_no_memory = AUG_ENOMEM
+       , err_internal = AUG_EINTERNAL
+       , err_bad_path = AUG_EPATHX
+       , err_no_match = AUG_ENOMATCH
+       , err_multi_matches = AUG_EMMATCH
+       , err_syntax = AUG_ESYNTAX
+       , err_no_lens = AUG_ENOLENS
+       , err_multi_xfm = AUG_EMXFM
 }
 
 
diff --git a/augeas.cabal b/augeas.cabal
--- a/augeas.cabal
+++ b/augeas.cabal
@@ -1,5 +1,5 @@
 Name: augeas
-Version: 0.1.2
+Version: 0.2.0
 Synopsis:  A Haskell FFI wrapper for the Augeas API
 Description: A Haskell FFI wrapper for the Augeas API
 Author: Jude Nagurney
@@ -7,6 +7,7 @@
 Cabal-Version: >= 1.2
 License: GPL
 License-File: LICENSE
+Data-Files: AUTHORS
 Build-Type: Custom
 Category: System
 Stability: Alpha
@@ -15,7 +16,7 @@
 library 
         Exposed-Modules: System.Augeas
         Other-Modules: System.AugeasHsc
-        Build-Depends: base >= 2.0, bytestring >= 0.9.0.1, unix >=2.3.0.0, haskell98
+        Build-Depends: base >= 2.0 && <4, directory, unix >=2.3.0.0, bytestring >= 0.9.0.1
         GHC-options: -Wall -fwarn-dodgy-imports
 
 executable "test-haskell-augeas"
