diff --git a/wscript b/wscript
index 6fc3bcc..1b44ea8 100644
--- a/wscript
+++ b/wscript
@@ -7,29 +7,24 @@
 GIT_TAG_PREFIX = "ndns-"
 
 from waflib import Logs, Utils, Context
-import os
+import os, subprocess
 
 def options(opt):
     opt.load(['compiler_cxx', 'gnu_dirs'])
     opt.load(['boost', 'default-compiler-flags', 'doxygen', 'sphinx_build',
-              'sqlite3', 'pch', 'sanitizers', 'coverage'], tooldir=['.waf-tools'])
+              'sqlite3', 'sanitizers', 'coverage'], tooldir=['.waf-tools'])
 
     ropt = opt.add_option_group('NDNS Options')
-
-    ropt.add_option('--with-tests', action='store_true', default=False, dest='with_tests',
-                    help='''build unit tests''')
+    ropt.add_option('--with-tests', action='store_true', default=False, help='build unit tests')
 
 def configure(conf):
     conf.load(['compiler_cxx', 'gnu_dirs',
                'boost', 'default-compiler-flags', 'doxygen', 'sphinx_build',
-               'sqlite3', 'pch', 'sanitizers', 'coverage'])
+               'sqlite3'])
 
     if 'PKG_CONFIG_PATH' not in os.environ:
         os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env)
 
-    conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'],
-                  uselib_store='LOG4CXX', mandatory=True)
-
     conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
                    uselib_store='NDN_CXX', mandatory=True)
 
@@ -39,24 +34,28 @@
         conf.env['WITH_TESTS'] = True
         conf.define('NDNS_HAVE_TESTS', 1)
 
-    USED_BOOST_LIBS = ['system', 'filesystem']
+    USED_BOOST_LIBS = ['system', 'filesystem', 'thread', 'log', 'log_setup']
     if conf.env['WITH_TESTS']:
         USED_BOOST_LIBS += ['unit_test_framework']
-    conf.check_boost(lib=USED_BOOST_LIBS, mandatory=True)
+    conf.check_boost(lib=USED_BOOST_LIBS, mandatory=True, mt=True)
 
-    if not conf.options.with_sqlite_locking:
-        conf.define('DISABLE_SQLITE3_FS_LOCKING', 1)
+    conf.check_compiler_flags()
 
-    conf.define("DEFAULT_CONFIG_PATH", "%s/ndns" % conf.env['SYSCONFDIR'])
-    conf.define("DEFAULT_DATABASE_PATH", "%s/ndns" % conf.env['LOCALSTATEDIR'])
+    # Loading "late" to prevent tests from being compiled with profiling flags
+    conf.load('coverage')
+
+    conf.load('sanitizers')
+
+    conf.define('DEFAULT_CONFIG_PATH', '%s/ndns' % conf.env['SYSCONFDIR'])
+    conf.define('DEFAULT_DATABASE_PATH', '%s/ndns' % conf.env['LOCALSTATEDIR'])
 
     conf.write_config_header('src/config.hpp')
 
 def build (bld):
     version(bld)
 
-    bld(features="subst",
-        name='version',
+    bld(features='subst',
+        name='version.hpp',
         source='src/version.hpp.in',
         target='src/version.hpp',
         install_path=None,
@@ -67,26 +66,22 @@
                 int(VERSION_SPLIT[2]),
         VERSION_MAJOR=VERSION_SPLIT[0],
         VERSION_MINOR=VERSION_SPLIT[1],
-        VERSION_PATCH=VERSION_SPLIT[2],
-        )
+        VERSION_PATCH=VERSION_SPLIT[2])
 
-    bld(
-        features='cxx',
+    bld.objects(
         name='ndns-objects',
-        source=bld.path.ant_glob(['src/**/*.cpp'],
-                                 excl=['src/main.cpp',]),
-        use='version NDN_CXX LOG4CXX BOOST',
+        source=bld.path.ant_glob('src/**/*.cpp', excl=['src/main.cpp',]),
+        use='version NDN_CXX BOOST',
         includes='src',
-        export_includes='src',
-    )
+        export_includes='src')
 
-    if bld.env['SPHINX_BUILD']:
-        bld(features="sphinx",
-            builder="man",
-            outdir="docs/manpages",
-            config="docs/conf.py",
+    if bld.env.SPHINX_BUILD:
+        bld(features='sphinx',
+            builder='man',
+            outdir='docs/manpages',
+            config='docs/conf.py',
             source=bld.path.ant_glob('docs/manpages/**/*.rst'),
-            install_path="${MANDIR}/",
+            install_path='${MANDIR}',
             VERSION=VERSION)
 
     bld.recurse('tests')
@@ -100,19 +95,9 @@
         name='validator-sample',
         ANCHORPATH='anchors/root.cert',
         RELATION='is-prefix-of',
-        DEFAULT_CONFIG_PATH="%s/ndns" % bld.env['SYSCONFDIR'],
-        DEFAULT_DATABASE_PATH="%s/ndns" % bld.env['LOCALSTATEDIR'],
-        help='the validator configuration of ndns',
-    )
-
-    bld(features='subst',
-        source='log4cxx.properties.sample.in',
-        target='log4cxx.properties.sample',
-        install_path='${SYSCONFDIR}/ndns',
-        is_copy = True,
-        name='log4cxx-sample',
-        help='the log4cxx configration file',
-    )
+        DEFAULT_CONFIG_PATH='%s/ndns' % bld.env['SYSCONFDIR'],
+        DEFAULT_DATABASE_PATH='%s/ndns' % bld.env['LOCALSTATEDIR'],
+        help='the validator configuration of ndns')
 
 def docs(bld):
     from waflib import Options
@@ -122,86 +107,82 @@
     version(bld)
 
     if not bld.env.DOXYGEN:
-        Logs.error("ERROR: cannot build documentation (`doxygen' is not found in $PATH)")
-    else:
-        bld(features="subst",
-            name="doxygen-conf",
-            source=["docs/doxygen.conf.in",
-                    "docs/named_data_theme/named_data_footer-with-analytics.html.in"],
-            target=["docs/doxygen.conf",
-                    "docs/named_data_theme/named_data_footer-with-analytics.html"],
-            VERSION=VERSION_BASE,
-            HTML_FOOTER="../build/docs/named_data_theme/named_data_footer-with-analytics.html" \
-                          if os.getenv('GOOGLE_ANALYTICS', None) \
-                          else "../docs/named_data_theme/named_data_footer.html",
-            GOOGLE_ANALYTICS=os.getenv('GOOGLE_ANALYTICS', ""),
-            )
+        bld.fatal('Cannot build documentation ("doxygen" not found in PATH)')
 
-        bld(features="doxygen",
-            doxyfile='docs/doxygen.conf',
-            use="doxygen-conf")
+    bld(features='subst',
+        name='doxygen.conf',
+        source=['docs/doxygen.conf.in',
+                'docs/named_data_theme/named_data_footer-with-analytics.html.in'],
+        target=['docs/doxygen.conf',
+                'docs/named_data_theme/named_data_footer-with-analytics.html'],
+        VERSION=VERSION,
+        HTML_FOOTER='../build/docs/named_data_theme/named_data_footer-with-analytics.html' \
+                        if os.getenv('GOOGLE_ANALYTICS', None) \
+                        else '../docs/named_data_theme/named_data_footer.html',
+        GOOGLE_ANALYTICS=os.getenv('GOOGLE_ANALYTICS', ''))
+
+    bld(features='doxygen',
+        doxyfile='docs/doxygen.conf',
+        use='doxygen.conf')
 
 def sphinx(bld):
     version(bld)
 
     if not bld.env.SPHINX_BUILD:
-        bld.fatal("ERROR: cannot build documentation (`sphinx-build' is not found in $PATH)")
-    else:
-        bld(features="sphinx",
-            outdir="docs",
-            source=bld.path.ant_glob('docs/**/*.rst'),
-            config="docs/conf.py",
-            VERSION=VERSION_BASE)
+        bld.fatal('Cannot build documentation ("sphinx-build" not found in PATH)')
+
+    bld(features='sphinx',
+        config='docs/conf.py',
+        outdir='docs',
+        source=bld.path.ant_glob('docs/**/*.rst'),
+        VERSION=VERSION)
 
 def version(ctx):
+    # don't execute more than once
     if getattr(Context.g_module, 'VERSION_BASE', None):
         return
 
     Context.g_module.VERSION_BASE = Context.g_module.VERSION
-    Context.g_module.VERSION_SPLIT = [v for v in VERSION_BASE.split('.')]
+    Context.g_module.VERSION_SPLIT = VERSION_BASE.split('.')
 
-    didGetVersion = False
+    # first, try to get a version string from git
+    gotVersionFromGit = False
     try:
         cmd = ['git', 'describe', '--always', '--match', '%s*' % GIT_TAG_PREFIX]
-        p = Utils.subprocess.Popen(cmd, stdout=Utils.subprocess.PIPE,
-                                   stderr=None, stdin=None)
-        out = str(p.communicate()[0].strip())
-        didGetVersion = (p.returncode == 0 and out != "")
-        if didGetVersion:
+        out = subprocess.check_output(cmd, universal_newlines=True).strip()
+        if out:
+            gotVersionFromGit = True
             if out.startswith(GIT_TAG_PREFIX):
-                Context.g_module.VERSION = out[len(GIT_TAG_PREFIX):]
+                Context.g_module.VERSION = out.lstrip(GIT_TAG_PREFIX)
             else:
-                Context.g_module.VERSION = "%s-commit-%s" % (Context.g_module.VERSION_BASE, out)
-    except OSError:
+                # no tags matched
+                Context.g_module.VERSION = '%s-commit-%s' % (VERSION_BASE, out)
+    except subprocess.CalledProcessError:
         pass
 
     versionFile = ctx.path.find_node('VERSION')
-
-    if not didGetVersion and versionFile is not None:
+    if not gotVersionFromGit and versionFile is not None:
         try:
             Context.g_module.VERSION = versionFile.read()
             return
-        except (OSError, IOError):
+        except EnvironmentError:
             pass
 
     # version was obtained from git, update VERSION file if necessary
     if versionFile is not None:
         try:
-            version = versionFile.read()
-            if version == Context.g_module.VERSION:
-                return # no need to update
-        except (OSError, IOError):
-            Logs.warn("VERSION file exists, but not readable")
+            if versionFile.read() == Context.g_module.VERSION:
+                # already up-to-date
+                return
+        except EnvironmentError as e:
+            Logs.warn('%s exists but is not readable (%s)' % (versionFile, e.strerror))
     else:
         versionFile = ctx.path.make_node('VERSION')
 
-    if versionFile is None:
-        return
-
     try:
         versionFile.write(Context.g_module.VERSION)
-    except (OSError, IOError):
-        Logs.warn("VERSION file is not writeable")
+    except EnvironmentError as e:
+        Logs.warn('%s is not writable (%s)' % (versionFile, e.strerror))
 
 def dist(ctx):
     version(ctx)
