diff --git a/wscript b/wscript
index 35590be..6e6d1db 100644
--- a/wscript
+++ b/wscript
@@ -2,72 +2,70 @@
 VERSION='0.5'
 APPNAME='ChronoChat'
 
-from waflib import Configure, Utils
+from waflib import Configure, Utils, Logs, Context
+import os
 
 def options(opt):
-    opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
-    opt.add_option('--with-log4cxx',action='store_true',default=False,dest='log4cxx',help='''Enable log4cxx''')
-    opt.add_option('--with-tests', action='store_true',default=False,dest='with_tests',help='''build unit tests''')
-    opt.add_option('--without-security', action='store_false',default=True,dest='with_security',help='''Enable security''')
 
-    opt.load('compiler_c compiler_cxx qt4')
-
+    opt.load(['compiler_c', 'compiler_cxx', 'qt4'])
     if Utils.unversioned_sys_platform () != "darwin":
         opt.load('gnu_dirs');
 
-    opt.load('boost protoc', tooldir=['waf-tools'])
+    opt.load(['default-compiler-flags', 'boost', 'protoc',
+              'doxygen', 'sphinx_build'],
+              tooldir=['waf-tools'])
+
+    opt = opt.add_option_group('ChronotChat Options')
+
+    opt.add_option('--with-tests', action='store_true', default=False, dest='with_tests',
+                   help='''build unit tests''')
+
+    opt.add_option('--with-log4cxx', action='store_true', default=False, dest='log4cxx',
+                   help='''Enable log4cxx''')
 
 def configure(conf):
-    conf.load("compiler_c compiler_cxx boost protoc qt4")
-
+    conf.load(['compiler_c', 'compiler_cxx', 'qt4',
+               'default-compiler-flags', 'boost', 'protoc',
+               'doxygen', 'sphinx_build'])
     if Utils.unversioned_sys_platform () != "darwin":
-        conf.load('gnu_dirs');
+        opt.load('gnu_dirs');
 
-    if conf.options.debug:
-        conf.define ('_DEBUG', 1)
-        conf.env['_DEBUG'] = True;
-        flags = ['-O0',
-                 '-Wall',
-                 '-Wno-unused-variable',
-                 '-g3',
-                 '-Wno-unused-private-field', # only clang supports
-                 '-fcolor-diagnostics',       # only clang supports
-                 '-Qunused-arguments',        # only clang supports
-                 '-Wno-deprecated-declarations',
-                 '-Wno-unneeded-internal-declaration',
-                 ]
-
-        conf.add_supported_cxxflags (cxxflags = flags)
-    else:
-        flags = ['-O3', '-g', '-Wno-tautological-compare', '-Wno-unused-function', '-Wno-deprecated-declarations']
-        conf.add_supported_cxxflags (cxxflags = flags)
-
-    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDN_CXX', mandatory=True)
-
+    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
+                   uselib_store='NDN_CXX', mandatory=True)
 
     if conf.options.log4cxx:
-        conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX', mandatory=True)
-        conf.define ("HAVE_LOG4CXX", 1)
+        conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'],
+                       uselib_store='LOG4CXX', mandatory=True)
+        conf.define("HAVE_LOG4CXX", 1)
 
-    conf.check_cfg (package='ChronoSync', args=['ChronoSync >= 0.1', '--cflags', '--libs'], uselib_store='SYNC', mandatory=True)
+    conf.check_cfg (package='ChronoSync', args=['ChronoSync >= 0.1', '--cflags', '--libs'],
+                    uselib_store='SYNC', mandatory=True)
 
-    conf.check_boost(lib='system random thread filesystem unit_test_framework')
-
+    boost_libs = 'system random thread filesystem'
     if conf.options.with_tests:
-        conf.env['WITH_TESTS'] = True
-        conf.define('WITH_TESTS', 1)
+        conf.env['WITH_TESTS'] = 1
+        conf.define('WITH_TESTS', 1);
+        boost_libs += ' unit_test_framework'
 
-
-    if conf.options.with_security:
-        conf.define('WITH_SECURITY', 1)
+    conf.check_boost(lib=boost_libs)
+    if conf.env.BOOST_VERSION_NUMBER < 104800:
+        Logs.error("Minimum required boost version is 1.48.0")
+        Logs.error("Please upgrade your distribution or install custom boost libraries" +
+                   " (http://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
+        return
 
     conf.write_config_header('src/config.h')
 
 def build (bld):
+    feature_list = 'qt4 cxx'
+    if bld.env["WITH_TESTS"]:
+        feature_list += ' cxxshlib'
+    else:
+        feature_list += ' cxxprogram'
+
     qt = bld (
         target = "ChronoChat",
-        features = "qt4 cxx cxxprogram",
-        # features= "qt4 cxx cxxshlib",
+        features = feature_list,
         defines = "WAF",
         source = bld.path.ant_glob(['src/*.cpp', 'src/*.ui', '*.qrc', 'logging.cc', 'src/*.proto']),
         includes = "src .",
@@ -75,15 +73,15 @@
         )
 
     # Unit tests
-    # if bld.env["WITH_TESTS"]:
-    #   unittests = bld.program (
-    #       target="unit-tests",
-    #       source = bld.path.ant_glob(['test/**/*.cc']),
-    #       features=['cxx', 'cxxprogram'],
-    #       use = 'BOOST ChronoChat',
-    #       includes = "src",
-    #       install_path = None,
-    #       )
+    if bld.env["WITH_TESTS"]:
+      unittests = bld.program (
+          target="unit-tests",
+          source = bld.path.ant_glob(['test/**/*.cpp']),
+          features=['cxx', 'cxxprogram'],
+          use = 'BOOST ChronoChat',
+          includes = "src .",
+          install_path = None,
+          )
 
     # Debug tools
     if bld.env["_DEBUG"]:
@@ -92,64 +90,107 @@
                 target = '%s' % (str(app.change_ext('','.cc'))),
                 source = app,
                 use = 'NDN_CXX',
+                includes = "src .",
                 install_path = None,
             )
 
-      # Tmp disable
-    if Utils.unversioned_sys_platform () == "darwin":
-        app_plist = '''<?xml version="1.0" encoding="UTF-8"?>
+    if not bld.env["WITH_TESTS"]:
+        if Utils.unversioned_sys_platform () == "darwin":
+            app_plist = '''<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
 <plist version="0.9">
-<dict>
-    <key>CFBundlePackageType</key>
-    <string>APPL</string>
-    <key>CFBundleIconFile</key>
-    <string>demo.icns</string>
-    <key>CFBundleGetInfoString</key>
-    <string>Created by Waf</string>
-    <key>CFBundleIdentifier</key>
-    <string>edu.ucla.cs.irl.ChronoChat</string>
-    <key>CFBundleSignature</key>
-    <string>????</string>
-    <key>NOTE</key>
-    <string>THIS IS A GENERATED FILE, DO NOT MODIFY</string>
-    <key>CFBundleExecutable</key>
-    <string>%s</string>
-    <key>SUPublicDSAKeyFile</key>
-    <string>dsa_pub.pem</string>
-    <key>CFBundleIconFile</key>
-    <string>demo.icns</string>
-</dict>
+    <dict>
+        <key>CFBundlePackageType</key>
+        <string>APPL</string>
+        <key>CFBundleIconFile</key>
+        <string>demo.icns</string>
+        <key>CFBundleGetInfoString</key>
+        <string>Created by Waf</string>
+        <key>CFBundleIdentifier</key>
+        <string>edu.ucla.cs.irl.ChronoChat</string>
+        <key>CFBundleSignature</key>
+        <string>????</string>
+        <key>NOTE</key>
+        <string>THIS IS A GENERATED FILE, DO NOT MODIFY</string>
+        <key>CFBundleExecutable</key>
+        <string>%s</string>
+        <key>SUPublicDSAKeyFile</key>
+        <string>dsa_pub.pem</string>
+        <key>CFBundleIconFile</key>
+        <string>demo.icns</string>
+    </dict>
 </plist>'''
 
     # <key>LSUIElement</key>
     # <string>1</string>
 
-        qt.mac_app = "ChronoChat.app"
-        qt.mac_plist = app_plist % "ChronoChat"
-        qt.mac_resources = 'demo.icns'
+            qt.mac_app = "ChronoChat.app"
+            qt.mac_plist = app_plist % "ChronoChat"
+            qt.mac_resources = 'demo.icns'
+        else:
+            bld(features = "subst",
+                source = 'linux/chronochat.desktop.in',
+                target = 'linux/chronochat.desktop',
+                BINARY = "ChronoChat",
+                install_path = "${DATAROOTDIR}/applications"
+                )
+            bld.install_files("${DATAROOTDIR}/chronochat",
+                              bld.path.ant_glob(['linux/Resources/*']))
+
+
+# docs
+def docs(bld):
+    from waflib import Options
+    Options.commands = ['doxygen', 'sphinx'] + Options.commands
+
+def doxygen(bld):
+    version(bld)
+
+    if not bld.env.DOXYGEN:
+        Logs.error("ERROR: cannot build documentation (`doxygen' is not found in $PATH)")
     else:
-        bld (features = "subst",
-             source = 'linux/chronochat.desktop.in',
-             target = 'linux/chronochat.desktop',
-             BINARY = "ChronoChat",
-             install_path = "${DATAROOTDIR}/applications"
+        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.install_files("${DATAROOTDIR}/chronochat",
-                          bld.path.ant_glob(['linux/Resources/*']))
 
+        bld(features="doxygen",
+            doxyfile='docs/doxygen.conf',
+            use="doxygen-conf")
 
-@Configure.conf
-def add_supported_cxxflags(self, cxxflags):
-    """
-    Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
-    """
-    self.start_msg('Checking allowed flags for c++ compiler')
+def sphinx(bld):
+    version(bld)
 
-    supportedFlags = []
-    for flag in cxxflags:
-        if self.check_cxx (cxxflags=[flag], mandatory=False):
-            supportedFlags += [flag]
+    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)
 
-    self.end_msg (' '.join (supportedFlags))
-    self.env.CXXFLAGS += supportedFlags
+def version(ctx):
+    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('.')]
+
+    try:
+        cmd = ['git', 'describe', '--match', 'ChronoChat-*']
+        p = Utils.subprocess.Popen(cmd, stdout=Utils.subprocess.PIPE,
+                                   stderr=None, stdin=None)
+        out = p.communicate()[0].strip()
+        if p.returncode == 0 and out != "":
+            Context.g_module.VERSION = out[11:]
+    except:
+        pass
