diff --git a/hpp.cabal b/hpp.cabal
--- a/hpp.cabal
+++ b/hpp.cabal
@@ -1,5 +1,5 @@
 name:                hpp
-version:             0.5.1
+version:             0.5.2
 synopsis:            A Haskell pre-processor
 description:         See the README for usage examples
 license:             BSD3
diff --git a/src/Hpp.hs b/src/Hpp.hs
--- a/src/Hpp.hs
+++ b/src/Hpp.hs
@@ -71,8 +71,10 @@
 streamHpp st snk (HppT h) =
   do (a, st') <- S.runStateT
                      (evalParse
-                        (R.runHpp (liftIO . readLines)
-                                  (lift . lift . lift . snk) h)
+                        (R.runHpp (T.hppConfig st)
+                                  (liftIO . readLines)
+                                  (lift . lift . lift . snk)
+                                  h)
                         [])
                      st
      either (throwE . snd) (return . (,st') . R.hppFilesRead) a
@@ -80,7 +82,10 @@
 -- | Like 'runHpp', but does not access the filesystem. Run a
 -- preprocessor action with some initial state. Returns the result of
 -- preprocessing as well as an updated preprocessor state
--- representation. Since this operation performs no IO, @#include@ directives are ignored in terms of the generated output lines, but the files named in those directive are available in the 'HppOutput' value returned.
+-- representation. Since this operation performs no IO, @#include@
+-- directives are ignored in terms of the generated output lines, but
+-- the files named in those directive are available in the 'HppOutput'
+-- value returned.
 expand :: T.HppState
        -> HppT (S.State ([ByteString] -> [ByteString])) a
        -> Except T.Error (HppOutput, T.HppState)
diff --git a/src/Hpp/CmdLine.hs b/src/Hpp/CmdLine.hs
--- a/src/Hpp/CmdLine.hs
+++ b/src/Hpp/CmdLine.hs
@@ -2,7 +2,7 @@
 -- | A front-end to run Hpp with textual arguments as from a command
 -- line invocation.
 module Hpp.CmdLine (runWithArgs) where
-import Control.Monad (unless)
+import Control.Monad (unless, (>=>))
 import Control.Monad.Trans.Except (runExceptT)
 import Data.String (fromString)
 import Hpp
@@ -101,18 +101,19 @@
      let fileName = curFileName cfg
          cfg' = cfg { curFileNameF = pure fileName }
      (snk, closeSnk) <- case outPath of
-                          Nothing -> return (mapM_ (putStringy stdout) , return ())
+                          Nothing -> return ( mapM_ (putStringy stdout)
+                                            , return () )
                           Just f ->
                             do h <- makeAbsolute f >>=
                                     flip openFile WriteMode
                                return ( \os -> mapM_ (putStringy h) os
                                       , hClose h )
-     let errorExcept = fmap (either (error . show) id) . runExceptT
+     let errorExcept = runExceptT >=> either (error . show) pure
      _ <- readLines fileName
-           >>= errorExcept
-               . streamHpp (initHppState cfg' env) snk
-               . preprocess
-               . (map fromString lns ++)
+            >>= errorExcept
+                . streamHpp (initHppState cfg' env) snk
+                . preprocess
+                . (map fromString lns ++)
      -- (lns', _) <- readLines fileName
      --              >>= errorExcept
      --                  . runHpp (initHppState cfg' env)
diff --git a/src/Hpp/Parser.hs b/src/Hpp/Parser.hs
--- a/src/Hpp/Parser.hs
+++ b/src/Hpp/Parser.hs
@@ -14,11 +14,16 @@
 
 -- * Parsers
 
+-- | Our input is a list of values each of which is either an action or a value.
 type RopeM m a = [Either (m ()) a]
 
--- | A 'Parser' is a bit of state carrying a source of input.
+-- | A 'ParserT' is a bit of state that carries a source of input.
 type ParserT m src i = StateT (Headspring m src i, src) m
 
+-- | A 'Parser' is a bit of state that carries a source of input
+-- consisting of a list of values which are either actions in an
+-- underlying monad or sequences of inputs. Thus we have chunks of
+-- input values with interspersed effects.
 type Parser m i = ParserT m (RopeM m [i]) i
 
 data Headspring m src i =
diff --git a/src/Hpp/RunHpp.hs b/src/Hpp/RunHpp.hs
--- a/src/Hpp/RunHpp.hs
+++ b/src/Hpp/RunHpp.hs
@@ -247,33 +247,33 @@
 -- | Interpret the IO components of the preprocessor. This
 -- implementation relies on IO for the purpose of checking search
 -- paths for included files.
-runHpp :: forall m a src. (MonadIO m, HasHppState m)
-       => (FilePath -> m src)
+runHpp :: forall m a src. (MonadIO m)
+       => Config
+       -> (FilePath -> m src)
        -> (src -> m ())
        -> HppT src m a
        -> m (Either (FilePath,Error) (HppResult a))
-runHpp source sink m = runHppT m >>= go []
+runHpp cfg source sink m = runHppT m >>= go []
   where go :: [FilePath]
            -> FreeF (HppF src) a (HppT src m a)
            -> m (Either (FilePath, Error) (HppResult a))
         go files (PureF x) = return $ Right (HppResult files x)
         go files (FreeF s) = case s of
           ReadFile ln file k ->
-            (includePaths <$> use config)
-            >>= liftIO . flip searchForInclude file
+            liftIO (searchForInclude (includePaths cfg) file)
             >>= readAux (file:files) ln file k
           ReadNext ln file k ->
-            (includePaths <$> use config)
-            >>= liftIO . flip searchForNextInclude file
+            liftIO (searchForNextInclude (includePaths cfg) file)
             >>= readAux (file:files) ln file k
           WriteOutput output k -> sink output >> runHppT k >>= go files
 
         readAux _files ln file _ Nothing =
-          Left . (, IncludeDoesNotExist ln file) . curFileName <$> use config
+          pure (Left (curFileName cfg, IncludeDoesNotExist ln file))
         readAux files _ln _file k (Just file') =
           source file' >>= runHppT . k >>= go files
 {-# SPECIALIZE runHpp ::
-    (FilePath -> Parser (StateT HppState (ExceptT Error IO)) [TOKEN] [String])
+    Config
+ -> (FilePath -> Parser (StateT HppState (ExceptT Error IO)) [TOKEN] [String])
  -> ([String] -> Parser (StateT HppState (ExceptT Error IO)) [TOKEN] ())
  -> HppT [String] (Parser (StateT HppState (ExceptT Error IO)) [TOKEN]) a
  -> Parser (StateT HppState (ExceptT Error IO)) [TOKEN] (Either (FilePath,Error) (HppResult a)) #-}
@@ -673,7 +673,7 @@
 hppIOSink' cfg env' snk src =
   fmap (fmap hppFilesRead)
   . dischargeHppCaps cfg env' $
-  runHpp (liftIO . readLines) (liftIO . snk) (preprocess src)
+  runHpp cfg (liftIO . readLines) (liftIO . snk) (preprocess src)
 
 -- | General hpp runner against input source file lines. Output lines
 -- are fed to the caller-supplied sink function. Any errors
diff --git a/src/Hpp/StringSig.hs b/src/Hpp/StringSig.hs
--- a/src/Hpp/StringSig.hs
+++ b/src/Hpp/StringSig.hs
@@ -12,6 +12,7 @@
 
 data CharOrSub s = CharMatch !s !s | SubMatch !s !s | NoMatch
 
+-- | A collection of operations relating to sequences of characters.
 class (IsString s, Monoid s) => Stringy s where
   -- | Stringification puts double quotes around a string and
   -- backslashes before existing double quote characters and backslash
diff --git a/src/Hpp/Types.hs b/src/Hpp/Types.hs
--- a/src/Hpp/Types.hs
+++ b/src/Hpp/Types.hs
@@ -85,8 +85,12 @@
 
 -- | Dynamic state of the preprocessor engine.
 data HppState = HppState { hppConfig :: Config
+                           -- ^ Initial configuration
                          , hppLineNum :: LineNum
-                         , hppEnv :: Env }
+                           -- ^ Current line number of input file
+                         , hppEnv :: Env
+                           -- ^ Preprocessor binding environment
+                         }
 
 -- | A free monad construction to strictly delimit what capabilities
 -- we need to perform pre-processing.
diff --git a/tests/mcpp-validation.sh b/tests/mcpp-validation.sh
--- a/tests/mcpp-validation.sh
+++ b/tests/mcpp-validation.sh
@@ -8,7 +8,7 @@
 # with BSD or OS X head.
 
 # Get the include paths GCC will use by default.
-GCCDIR=($(echo | ${GCC} -E -v - 2>&1 | sed -n '/#include <...> search starts/,/End of search list/ p' | tail -n +2 | sed '$ d' | grep -v '(framework directory)' | sed 's/^[[:space:]]*//'))
+GCCDIR=($(${GCC} -xc -E -v /dev/null 2>&1 | sed -n '/#include <...> search starts/,/End of search list/p' | tail -n +2 | sed '$ d' | grep -v '(framework directory)' | sed 's/^[[:space:]]*//' | tac))
 
 if (! [ $? -eq 0 ]) || [ -z "${GCCDIR}" ]; then
   GCCDIR=""
@@ -35,7 +35,7 @@
 if [ -z "$TRAVIS" ]; then
   (cd .. && stack build hpp:hpp)
 else
-  (cd .. && cabal build)
+  (cd .. && cabal new-build)
 fi
 if ! [ $? -eq 0 ]; then
   echo 'Building hpp failed'
@@ -52,10 +52,16 @@
 # Note that we define __i386__ as the architecture as the MCPP
 # validation test n_12.c assumes a long is 32 bits.
 
+
 if [ -z "$TRAVIS" ]; then
-  (cd mcpp-2.7.2/test-c &&  ../tool/cpp_test HPP "$(cd ../../.. && stack exec which -- hpp) -I/usr/include ${GCCDIR} --cpp -D__i386__ -D__DARWIN_ONLY_UNIX_CONFORMANCE %s.c | gcc -o %s -w -x c -" "rm %s" < n_i_.lst)
+  case $(uname -s) in
+      Darwin)
+          (cd mcpp-2.7.2/test-c &&  ../tool/cpp_test HPP "$(cd ../../.. && stack exec which -- hpp) -I/usr/include ${GCCDIR} --cpp -D__i386__ -D__DARWIN_ONLY_UNIX_CONFORMANCE %s.c | gcc -o %s -w -x c -" "rm %s" < n_i_.lst)
+          ;;
+      *) (cd mcpp-2.7.2/test-c &&  ../tool/cpp_test HPP "$(find $(pwd)/../../../.stack-work -type f -executable -name hpp -print -quit) ${GCCDIR} --cpp -D__x86_64__ %s.c | gcc -o %s -w -x c -" "rm %s" < n_i_.lst)
+  esac
 else
-  (cd mcpp-2.7.2/test-c &&  ../tool/cpp_test HPP "$(find ../../../dist -type f -executable -name hpp) -I/usr/include ${GCCDIR} --cpp -D__i386__ -D__DARWIN_ONLY_UNIX_CONFORMANCE %s.c | gcc -o %s -w -x c -" "rm %s" < n_i_.lst)
+  (cd mcpp-2.7.2/test-c &&  ../tool/cpp_test HPP "$(find $(pwd)/../../../../dist-newstyle -type f -executable -name hpp) ${GCCDIR} --cpp -D__x86_64__ %s.c | gcc -o %s -w -x c -" "rm %s" < n_i_.lst)
 fi
 
 if ! [ $? -eq 0 ]; then
