diff --git a/tools/ndn-autoconfig/base.cpp b/tools/ndn-autoconfig/base.cpp
index a796f4c..c95eb21 100644
--- a/tools/ndn-autoconfig/base.cpp
+++ b/tools/ndn-autoconfig/base.cpp
@@ -40,7 +40,7 @@
 void
 Base::connectToHub(const std::string& uri)
 {
-  util::FaceUri faceUri(uri);
+  FaceUri faceUri(uri);
 
   faceUri.canonize(bind(&Base::onCanonizeSuccess, this, _1),
                    bind(&Base::onCanonizeFailure, this, _1),
@@ -50,26 +50,24 @@
 
 
 void
-Base::onCanonizeSuccess(const util::FaceUri& canonicalUri)
+Base::onCanonizeSuccess(const FaceUri& canonicalUri)
 {
   std::cerr << "About to connect to: " << canonicalUri.toString() << std::endl;
 
-  m_controller.start<nfd::FaceCreateCommand>(nfd::ControlParameters()
-                                               .setUri(canonicalUri.toString()),
-                                             bind(&Base::onHubConnectSuccess, this, _1),
-                                             bind(&Base::onHubConnectError, this, _1));
+  m_controller.start<ndn::nfd::FaceCreateCommand>(
+    ControlParameters().setUri(canonicalUri.toString()),
+    bind(&Base::onHubConnectSuccess, this, _1),
+    bind(&Base::onHubConnectError, this, _1));
 }
 
 void
 Base::onCanonizeFailure(const std::string& reason)
 {
-  std::ostringstream os;
-  os << "FaceUri canonization failed: " << reason;
-  BOOST_THROW_EXCEPTION(Error(os.str()));
+  BOOST_THROW_EXCEPTION(Error("FaceUri canonization failed: " + reason));
 }
 
 void
-Base::onHubConnectSuccess(const nfd::ControlParameters& resp)
+Base::onHubConnectSuccess(const ControlParameters& resp)
 {
   std::cerr << "Successfully created face: " << resp << std::endl;
 
@@ -81,7 +79,7 @@
 }
 
 void
-Base::onHubConnectError(const nfd::ControlResponse& response)
+Base::onHubConnectError(const ControlResponse& response)
 {
   std::ostringstream os;
   os << "Failed to create face: " << response.getText() << " (code: " << response.getCode() << ")";
@@ -92,28 +90,28 @@
 Base::registerPrefix(const Name& prefix, uint64_t faceId)
 {
   // Register a prefix in RIB
-  m_controller.start<nfd::RibRegisterCommand>(nfd::ControlParameters()
-                                                .setName(prefix)
-                                                .setFaceId(faceId)
-                                                .setOrigin(nfd::ROUTE_ORIGIN_AUTOCONF)
-                                                .setCost(100)
-                                                .setExpirationPeriod(time::milliseconds::max()),
-                                              bind(&Base::onPrefixRegistrationSuccess, this, _1),
-                                              bind(&Base::onPrefixRegistrationError, this, _1));
+  m_controller.start<ndn::nfd::RibRegisterCommand>(
+    ControlParameters()
+      .setName(prefix)
+      .setFaceId(faceId)
+      .setOrigin(ndn::nfd::ROUTE_ORIGIN_AUTOCONF)
+      .setCost(100)
+      .setExpirationPeriod(time::milliseconds::max()),
+    bind(&Base::onPrefixRegistrationSuccess, this, _1),
+    bind(&Base::onPrefixRegistrationError, this, _1));
 }
 
 void
-Base::onPrefixRegistrationSuccess(const nfd::ControlParameters& commandSuccessResult)
+Base::onPrefixRegistrationSuccess(const ControlParameters& commandSuccessResult)
 {
   std::cerr << "Successful in name registration: " << commandSuccessResult << std::endl;
 }
 
 void
-Base::onPrefixRegistrationError(const nfd::ControlResponse& response)
+Base::onPrefixRegistrationError(const ControlResponse& response)
 {
-  std::ostringstream os;
-  os << "Failed in name registration, " << response.getText() << " (code: " << response.getCode() << ")";
-  BOOST_THROW_EXCEPTION(Error(os.str()));
+  BOOST_THROW_EXCEPTION(Error("Failed in name registration, " + response.getText() +
+                              " (code: " + to_string(response.getCode()) + ")"));
 }
 
 
diff --git a/tools/ndn-autoconfig/base.hpp b/tools/ndn-autoconfig/base.hpp
index e66020c..7cdfcca 100644
--- a/tools/ndn-autoconfig/base.hpp
+++ b/tools/ndn-autoconfig/base.hpp
@@ -29,16 +29,20 @@
 #include "core/common.hpp"
 
 #include <ndn-cxx/face.hpp>
-#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/encoding/buffer-stream.hpp>
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
 #include <ndn-cxx/mgmt/nfd/face-status.hpp>
-#include <ndn-cxx/encoding/buffer-stream.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
 #include <ndn-cxx/util/face-uri.hpp>
 
 namespace ndn {
 namespace tools {
 namespace autoconfig {
 
+using ndn::nfd::ControlParameters;
+using ndn::nfd::ControlResponse;
+using ndn::util::FaceUri;
+
 /**
  * @brief Base class for discovery stages
  */
@@ -68,7 +72,7 @@
 
 protected:
   /**
-   * @brief Initialize variables and create nfd::Controller instance
+   * @brief Initialize variables and create Controller instance
    * @param face Face to be used for all operations (e.g., will send registration commands)
    * @param keyChain KeyChain object
    * @param nextStageOnFailure Callback to be called after the stage failed
@@ -84,30 +88,30 @@
 
 private:
   void
-  onCanonizeSuccess(const util::FaceUri& canonicalUri);
+  onCanonizeSuccess(const FaceUri& canonicalUri);
 
   void
   onCanonizeFailure(const std::string& reason);
 
   void
-  onHubConnectSuccess(const nfd::ControlParameters& resp);
+  onHubConnectSuccess(const ControlParameters& resp);
 
   void
-  onHubConnectError(const nfd::ControlResponse& response);
+  onHubConnectError(const ControlResponse& response);
 
   void
   registerPrefix(const Name& prefix, uint64_t faceId);
 
   void
-  onPrefixRegistrationSuccess(const nfd::ControlParameters& commandSuccessResult);
+  onPrefixRegistrationSuccess(const ControlParameters& commandSuccessResult);
 
   void
-  onPrefixRegistrationError(const nfd::ControlResponse& response);
+  onPrefixRegistrationError(const ControlResponse& response);
 
 protected:
   Face& m_face;
   KeyChain& m_keyChain;
-  nfd::Controller m_controller;
+  ndn::nfd::Controller m_controller;
   NextStageCallback m_nextStageOnFailure;
 };
 
diff --git a/tools/ndn-autoconfig/main.cpp b/tools/ndn-autoconfig/main.cpp
index 666cca1..61ae22a 100644
--- a/tools/ndn-autoconfig/main.cpp
+++ b/tools/ndn-autoconfig/main.cpp
@@ -35,13 +35,16 @@
 
 #include <boost/noncopyable.hpp>
 #include <boost/program_options/options_description.hpp>
-#include <boost/program_options/variables_map.hpp>
 #include <boost/program_options/parsers.hpp>
+#include <boost/program_options/variables_map.hpp>
 
 namespace po = boost::program_options;
 
 namespace ndn {
 namespace tools {
+namespace autoconfig {
+// ndn-autoconfig is an NDN tool not an NFD tool, so it uses ndn::tools::autoconfig namespace.
+// It lives in NFD repository because nfd-start can automatically start ndn-autoconfig in daemon mode.
 
 class NdnAutoconfig : boost::noncopyable
 {
@@ -83,7 +86,7 @@
                })
   {
     if (m_isDaemonMode) {
-      m_networkMonitor.reset(new util::NetworkMonitor(m_io));
+      m_networkMonitor.reset(new ndn::util::NetworkMonitor(m_io));
       m_networkMonitor->onNetworkStateChanged.connect([this] {
           // delay stages, so if multiple events are triggered in short sequence,
           // only one auto-detection procedure is triggered
@@ -118,7 +121,6 @@
     m_io.stop();
   }
 
-
   static void
   usage(std::ostream& os,
         const po::options_description& optionDescription,
@@ -151,15 +153,12 @@
   bool m_isDaemonMode;
   boost::asio::signal_set m_terminationSignalSet;
 
-  autoconfig::MulticastDiscovery m_stage1;
-  autoconfig::GuessFromSearchDomains m_stage2;
-  autoconfig::GuessFromIdentityName m_stage3;
+  MulticastDiscovery m_stage1;
+  GuessFromSearchDomains m_stage2;
+  GuessFromIdentityName m_stage3;
 };
 
-} // namespace tools
-} // namespace ndn
-
-int
+static int
 main(int argc, char** argv)
 {
   bool isDaemonMode = false;
@@ -185,12 +184,12 @@
   }
   catch (const std::exception& e) {
     std::cerr << "ERROR: " << e.what() << "\n" << std::endl;
-    ndn::tools::NdnAutoconfig::usage(std::cerr, optionDescription, argv[0]);
+    NdnAutoconfig::usage(std::cerr, optionDescription, argv[0]);
     return 1;
   }
 
   if (options.count("help")) {
-    ndn::tools::NdnAutoconfig::usage(std::cout, optionDescription, argv[0]);
+    NdnAutoconfig::usage(std::cout, optionDescription, argv[0]);
     return 0;
   }
 
@@ -224,7 +223,7 @@
   }
 
   try {
-    ndn::tools::NdnAutoconfig autoConfigInstance(isDaemonMode);
+    NdnAutoconfig autoConfigInstance(isDaemonMode);
     autoConfigInstance.run();
   }
   catch (const std::exception& error) {
@@ -233,3 +232,13 @@
   }
   return 0;
 }
+
+} // namespace autoconfig
+} // namespace tools
+} // namespace ndn
+
+int
+main(int argc, char** argv)
+{
+  return ndn::tools::autoconfig::main(argc, argv);
+}
diff --git a/tools/ndn-autoconfig/multicast-discovery.cpp b/tools/ndn-autoconfig/multicast-discovery.cpp
index a474899..4efcec6 100644
--- a/tools/ndn-autoconfig/multicast-discovery.cpp
+++ b/tools/ndn-autoconfig/multicast-discovery.cpp
@@ -36,8 +36,8 @@
 MulticastDiscovery::MulticastDiscovery(Face& face, KeyChain& keyChain,
                                        const NextStageCallback& nextStageOnFailure)
   : Base(face, keyChain, nextStageOnFailure)
-  , nRequestedRegs(0)
-  , nFinishedRegs(0)
+  , m_nRequestedRegs(0)
+  , m_nFinishedRegs(0)
 {
 }
 
@@ -46,14 +46,11 @@
 {
   std::cerr << "Trying multicast discovery..." << std::endl;
 
-  util::SegmentFetcher::fetch(m_face, Interest("/localhost/nfd/faces/list"),
-                              m_validator,
-                              [this] (const ConstBufferPtr& data) {
-                                registerHubDiscoveryPrefix(data);
-                              },
-                              [this] (uint32_t code, const std::string& msg) {
-                                m_nextStageOnFailure(msg);
-                              });
+  util::SegmentFetcher::fetch(
+    m_face, Interest("/localhost/nfd/faces/list"),
+    m_validator,
+    [this] (const ConstBufferPtr& data) { registerHubDiscoveryPrefix(data); },
+    [this] (uint32_t code, const std::string& msg) { m_nextStageOnFailure(msg); });
 }
 
 void
@@ -73,9 +70,9 @@
 
     offset += block.size();
 
-    nfd::FaceStatus faceStatus(block);
+    ndn::nfd::FaceStatus faceStatus(block);
 
-    ndn::util::FaceUri uri(faceStatus.getRemoteUri());
+    FaceUri uri(faceStatus.getRemoteUri());
     if (uri.getScheme() == "udp4") {
       namespace ip = boost::asio::ip;
       boost::system::error_code ec;
@@ -93,22 +90,21 @@
     m_nextStageOnFailure("No multicast faces available, skipping multicast discovery stage");
   }
   else {
-    nfd::ControlParameters parameters;
+    ControlParameters parameters;
     parameters
       .setName(LOCALHOP_HUB_DISCOVERY_PREFIX)
       .setCost(1)
       .setExpirationPeriod(time::seconds(30));
 
-    nRequestedRegs = multicastFaces.size();
-    nFinishedRegs = 0;
+    m_nRequestedRegs = multicastFaces.size();
+    m_nFinishedRegs = 0;
 
     for (const auto& face : multicastFaces) {
       parameters.setFaceId(face);
-      m_controller.start<nfd::RibRegisterCommand>(parameters,
-                                                  bind(&MulticastDiscovery::onRegisterSuccess,
-                                                       this),
-                                                  bind(&MulticastDiscovery::onRegisterFailure,
-                                                       this, _1));
+      m_controller.start<ndn::nfd::RibRegisterCommand>(
+        parameters,
+        bind(&MulticastDiscovery::onRegisterSuccess, this),
+        bind(&MulticastDiscovery::onRegisterFailure, this, _1));
     }
   }
 }
@@ -116,23 +112,24 @@
 void
 MulticastDiscovery::onRegisterSuccess()
 {
-  ++nFinishedRegs;
+  ++m_nFinishedRegs;
 
-  if (nRequestedRegs == nFinishedRegs) {
+  if (m_nRequestedRegs == m_nFinishedRegs) {
     MulticastDiscovery::setStrategy();
   }
 }
 
 void
-MulticastDiscovery::onRegisterFailure(const nfd::ControlResponse& response)
+MulticastDiscovery::onRegisterFailure(const ControlResponse& response)
 {
   std::cerr << "ERROR: " << response.getText() << " (code: " << response.getCode() << ")" << std::endl;
-  --nRequestedRegs;
+  --m_nRequestedRegs;
 
-  if (nRequestedRegs == nFinishedRegs) {
-    if (nRequestedRegs > 0) {
+  if (m_nRequestedRegs == m_nFinishedRegs) {
+    if (m_nRequestedRegs > 0) {
       MulticastDiscovery::setStrategy();
-    } else {
+    }
+    else {
       m_nextStageOnFailure("Failed to register " + LOCALHOP_HUB_DISCOVERY_PREFIX.toUri() +
                            " for all multicast faces, skipping multicast discovery stage");
     }
@@ -142,19 +139,19 @@
 void
 MulticastDiscovery::setStrategy()
 {
-  nfd::ControlParameters parameters;
+  ControlParameters parameters;
   parameters
     .setName(LOCALHOP_HUB_DISCOVERY_PREFIX)
     .setStrategy("/localhost/nfd/strategy/multicast");
 
-  m_controller.start<nfd::StrategyChoiceSetCommand>(parameters,
-                                                    bind(&MulticastDiscovery::requestHubData, this),
-                                                    bind(&MulticastDiscovery::onSetStrategyFailure,
-                                                         this, _1));
+  m_controller.start<ndn::nfd::StrategyChoiceSetCommand>(
+    parameters,
+    bind(&MulticastDiscovery::requestHubData, this),
+    bind(&MulticastDiscovery::onSetStrategyFailure, this, _1));
 }
 
 void
-MulticastDiscovery::onSetStrategyFailure(const nfd::ControlResponse& response)
+MulticastDiscovery::onSetStrategyFailure(const ControlResponse& response)
 {
   m_nextStageOnFailure("Failed to set multicast strategy for " +
                        LOCALHOP_HUB_DISCOVERY_PREFIX.toUri() + " namespace (" + response.getText() + "). "
diff --git a/tools/ndn-autoconfig/multicast-discovery.hpp b/tools/ndn-autoconfig/multicast-discovery.hpp
index 32f7133..b437aee 100644
--- a/tools/ndn-autoconfig/multicast-discovery.hpp
+++ b/tools/ndn-autoconfig/multicast-discovery.hpp
@@ -69,13 +69,13 @@
   onRegisterSuccess();
 
   void
-  onRegisterFailure(const nfd::ControlResponse& response);
+  onRegisterFailure(const ControlResponse& response);
 
   void
   setStrategy();
 
   void
-  onSetStrategyFailure(const nfd::ControlResponse& response);
+  onSetStrategyFailure(const ControlResponse& response);
 
   // Start to look for a hub (NDN hub discovery first stage)
   void
@@ -85,8 +85,8 @@
   onSuccess(Data& data);
 
 private:
-  size_t nRequestedRegs;
-  size_t nFinishedRegs;
+  size_t m_nRequestedRegs;
+  size_t m_nFinishedRegs;
 
   ndn::ValidatorNull m_validator;
 };
