diff --git a/Changelog.md b/Changelog.md
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,3 +1,11 @@
+### 0.5.5.0
+
+- Refactor function *buildSharedLib* in module *NgxExport.Distribution*.
+- Adjust verbosity levels in *nhm-tool* based on levels passed in *cabal* or
+  *Setup.hs* (*-v0* &rarr; nothing, *-v1* or nothing &rarr; *-v*, other &rarr;
+  *-vv*).
+- *nhm-tool*: use default directory *.hslibs* if *distDataDir* was passed empty.
+
 ### 0.5.4.3
 
 - *nhm-tool*: fix bios shell script in generated *hie.yaml* for environments
diff --git a/NgxExport/Distribution.hs b/NgxExport/Distribution.hs
--- a/NgxExport/Distribution.hs
+++ b/NgxExport/Distribution.hs
@@ -58,7 +58,6 @@
 import Distribution.Pretty
 import System.Directory
 import System.FilePath
-import Control.Arrow
 import Control.Monad
 import Data.Maybe
 
@@ -356,26 +355,28 @@
                -> BuildFlags                        -- ^ Build flags
                -> IO FilePath
 buildSharedLib verbosity desc lbi flags = do
-    let configGhcOptions =
-            maybe [] (map ("ghc", )) $
-                lookup GHC $ perCompilerFlavorToList $
-                    options $ libBuildInfo $ fromJust $ library desc
+    let configGhcOptions = fromMaybe [] $
+            lookup GHC $ perCompilerFlavorToList $
+                options $ libBuildInfo $ fromJust $ library desc
         lib = fst $
-            foldl (\a@(r, _) (prog, v) ->
-                if prog /= "ghc" || isJust r
-                    then a
-                    else foldl (\a'@(r', ready) v' ->
-                                    if isJust r'
-                                        then a'
-                                        else if v' == "-o"
-                                                 then (Nothing, True)
-                                                 else if ready
-                                                          then (Just v', False)
-                                                          else (Nothing, False)
-                               ) a v
-                  ) (Nothing, False) $
-                      buildProgramArgs flags ++
-                          map (second pure) configGhcOptions
+            foldl (\a@(r, _) v ->
+                      case r of
+                          Nothing ->
+                              foldl (\a'@(r', ready) v' ->
+                                        case r' of
+                                            Nothing | v' == "-o" -> libReady
+                                                    | ready -> libFound v'
+                                                    | otherwise -> libNotFound
+                                            _ -> a'
+                                    ) libNotFound v
+                          _ -> a
+                  ) libNotFound [concatMap snd $ filter (("ghc" ==) . fst) $
+                                     buildProgramArgs flags
+                                ,configGhcOptions
+                                ]
+        libNotFound = (Nothing, False)
+        libReady = (Nothing, True)
+        libFound = (, False) . Just
         (lib', extraGhcOptions) =
             maybe (let name = unPackageName $ pkgName $ package desc
                        nameSo = name <.> "so"
@@ -390,11 +391,12 @@
         _ -> return ()
     ghcP <- fst <$> requireProgram verbosity ghcProgram (withPrograms lbi)
     let libGhcOptions = ["-dynamic", "-shared", "-fPIC"]
-        libGhcOptions' = if programVersion ghcP >= Just (mkVersion [9, 0, 1])
-                             then "-flink-rts" : libGhcOptions
-                             else libGhcOptions
-        ghcR = programInvocation ghcP $
-            libGhcOptions' ++ map snd configGhcOptions ++ extraGhcOptions
+        linkRtsOption
+            | programVersion ghcP >= Just (mkVersion [9, 0, 1]) =
+                ["-flink-rts"]
+            | otherwise = []
+        ghcR = programInvocation ghcP $ libGhcOptions ++
+            linkRtsOption ++ configGhcOptions ++ extraGhcOptions
     runProgramInvocation verbosity ghcR
     return lib'
 
@@ -420,15 +422,18 @@
                              -> LocalBuildInfo      -- ^ Local build info
                              -> IO ()
 patchAndCollectDependentLibs verbosity lib desc lbi = do
-    let dir = maybe "unspecified-abi" fromPathTemplate $ lookup AbiVar $
+    let verbosityArg v | v == silent = []
+                       | v == normal = ["-v"]
+                       | otherwise = ["-vv"]
+        dir = maybe "unspecified-abi" fromPathTemplate $ lookup AbiVar $
             abiTemplateEnv (compilerInfo $ compiler lbi) $ hostPlatform lbi
-        dirArg = "-d" : [dir]
         rpathArg = maybe [] (("-t" :) . pure . (</> dir) . fromPathTemplate) $
             flagToMaybe $ prefix $ configInstallDirs $ configFlags lbi
-        archiveArg = "-a" : [prettyShow $ package desc]
+        dirArg = ["-d", dir]
+        archiveArg = ["-a", prettyShow $ package desc]
     nhmToolP <- fst <$> requireProgram verbosity nhmTool (withPrograms lbi)
-    let nhmToolR = programInvocation nhmToolP $
-            "dist" : lib : "-v" : rpathArg ++ dirArg ++ archiveArg
+    let nhmToolR = programInvocation nhmToolP $ "dist" : lib :
+            verbosityArg verbosity ++ rpathArg ++ dirArg ++ archiveArg
     runProgramInvocation verbosity nhmToolR
 
 -- | Build hooks.
diff --git a/ngx-export-distribution.cabal b/ngx-export-distribution.cabal
--- a/ngx-export-distribution.cabal
+++ b/ngx-export-distribution.cabal
@@ -1,5 +1,5 @@
 name:                       ngx-export-distribution
-version:                    0.5.4.3
+version:                    0.5.5.0
 synopsis:                   Build custom libraries for Nginx Haskell module
 description:                Build custom libraries for
         <https://github.com/lyokha/nginx-haskell-module Nginx Haskell module>.
diff --git a/nhm-tool.hs b/nhm-tool.hs
--- a/nhm-tool.hs
+++ b/nhm-tool.hs
@@ -172,18 +172,17 @@
               | arg `elem` ["-v", "-version", "--version"] ->
                   putStrLn progVersion >> exitSuccess
         args' -> usage Nothing $ null args'
-    where normalizeDistData dist@DistData {..} =
-              dist { distDataTargetDir =
-                         if distDataTargetDir == "-"
-                             then ""
-                             else distDataTargetDir
-                   , distDataArchive =
-                         if distDataArchive == "-"
-                             then ""
-                             else distDataArchive
-                   , distDataPatchOnly =
-                         distDataDir == "-" || distDataPatchOnly
-                   }
+    where normalizeDistData dist@DistData { distDataDir = "-" } =
+              normalizeDistData dist { distDataDir = defaultDistDataDir
+                                     , distDataPatchOnly = True
+                                     }
+          normalizeDistData dist@DistData { distDataArchive = "-" } =
+              normalizeDistData dist { distDataArchive = "" }
+          normalizeDistData dist@DistData { distDataTargetDir = "-" } =
+              normalizeDistData dist { distDataTargetDir = "" }
+          normalizeDistData dist@DistData { distDataDir = "" } =
+              normalizeDistData dist { distDataDir = defaultDistDataDir }
+          normalizeDistData dist = dist
 
 parseDistArg :: Maybe DistData -> String -> Maybe DistData
 parseDistArg Nothing _ = Nothing
@@ -431,11 +430,10 @@
                  )
                 ,("hie.yaml", hieYaml init', True)
                 ]
-    forM_ files $
+    forM_ files $ \(name, file, overridable) ->
         if initDataToStdout
-            then \(name, file, _) ->
-                printHeader (name ++ "\n") >> T.putStrLn file
-            else \(name, file, overridable) -> do
+            then printHeader (name ++ "\n") >> T.putStrLn file
+            else do
                 exists <- doesFileExist name
                 if exists
                     then if initDataForce && overridable
