diff --git a/core/config-file.cpp b/core/config-file.cpp
index 19bf1cb..b9f40b1 100644
--- a/core/config-file.cpp
+++ b/core/config-file.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+ * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -59,10 +59,10 @@
 }
 
 bool
-ConfigFile::parseYesNo(const ConfigSection::value_type& option,
+ConfigFile::parseYesNo(const ConfigSection& node, const std::string& key,
                        const std::string& sectionName)
 {
-  auto value = option.second.get_value<std::string>();
+  auto value = node.get_value<std::string>();
 
   if (value == "yes") {
     return true;
@@ -72,7 +72,7 @@
   }
 
   BOOST_THROW_EXCEPTION(Error("Invalid value \"" + value + "\" for option \"" +
-                              option.first + "\" in \"" + sectionName + "\" section"));
+                              key + "\" in \"" + sectionName + "\" section"));
 }
 
 void
@@ -85,14 +85,10 @@
 void
 ConfigFile::parse(const std::string& filename, bool isDryRun)
 {
-  std::ifstream inputFile;
-  inputFile.open(filename.c_str());
-  if (!inputFile.good() || !inputFile.is_open())
-    {
-      std::string msg = "Failed to read configuration file: ";
-      msg += filename;
-      BOOST_THROW_EXCEPTION(Error(msg));
-    }
+  std::ifstream inputFile(filename);
+  if (!inputFile.good() || !inputFile.is_open()) {
+    BOOST_THROW_EXCEPTION(Error("Failed to read configuration file: " + filename));
+  }
   parse(inputFile, isDryRun, filename);
   inputFile.close();
 }
@@ -107,18 +103,16 @@
 void
 ConfigFile::parse(std::istream& input, bool isDryRun, const std::string& filename)
 {
-  try
-    {
-      boost::property_tree::read_info(input, m_global);
-    }
-  catch (const boost::property_tree::info_parser_error& error)
-    {
-      std::stringstream msg;
-      msg << "Failed to parse configuration file";
-      msg << " " << filename;
-      msg << " " << error.message() << " line " << error.line();
-      BOOST_THROW_EXCEPTION(Error(msg.str()));
-    }
+  try {
+    boost::property_tree::read_info(input, m_global);
+  }
+  catch (const boost::property_tree::info_parser_error& error) {
+    std::stringstream msg;
+    msg << "Failed to parse configuration file";
+    msg << " " << filename;
+    msg << " " << error.message() << " line " << error.line();
+    BOOST_THROW_EXCEPTION(Error(msg.str()));
+  }
 
   process(isDryRun, filename);
 }
@@ -144,7 +138,7 @@
 
   for (const auto& i : m_global) {
     try {
-      ConfigSectionHandler subscriber = m_subscriptions.at(i.first);
+      const ConfigSectionHandler& subscriber = m_subscriptions.at(i.first);
       subscriber(i.second, isDryRun, filename);
     }
     catch (const std::out_of_range&) {
@@ -153,4 +147,4 @@
   }
 }
 
-}
+} // namespace nfd
diff --git a/core/config-file.hpp b/core/config-file.hpp
index f6e4aaf..890a22c 100644
--- a/core/config-file.hpp
+++ b/core/config-file.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+ * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -45,6 +45,8 @@
                       const ConfigSection& /*section*/,
                       bool /*isDryRun*/)> UnknownConfigSectionHandler;
 
+/** \brief configuration file parsing utility
+ */
 class ConfigFile : noncopyable
 {
 public:
@@ -61,6 +63,7 @@
   explicit
   ConfigFile(UnknownConfigSectionHandler unknownSectionCallback = throwErrorOnUnknownSection);
 
+public: // unknown section handlers
   static void
   throwErrorOnUnknownSection(const std::string& filename,
                              const std::string& sectionName,
@@ -73,27 +76,50 @@
                        const ConfigSection& section,
                        bool isDryRun);
 
-  /**
-   * \brief parse a config option that can be either "yes" or "no"
-   *
-   * \return true if "yes", false if "no"
-   * \throw Error the value is neither "yes" nor "no"
+public: // parse helpers
+  /** \brief parse a config option that can be either "yes" or "no"
+   *  \retval true "yes"
+   *  \retval false "no"
+   *  \throw Error the value is neither "yes" nor "no"
    */
   static bool
-  parseYesNo(const ConfigSection::value_type& option,
-             const std::string& sectionName);
+  parseYesNo(const ConfigSection& node, const std::string& key, const std::string& sectionName);
+
+  static bool
+  parseYesNo(const ConfigSection::value_type& option, const std::string& sectionName)
+  {
+    return parseYesNo(option.second, option.first, sectionName);
+  }
 
   /**
    * \brief parse a numeric (integral or floating point) config option
+   * \tparam T an arithmetic type
    *
    * \return the numeric value of the parsed option
    * \throw Error the value cannot be converted to the specified type
    */
-  template <typename T>
-  static typename std::enable_if<std::is_arithmetic<T>::value, T>::type
-  parseNumber(const ConfigSection::value_type& option,
-              const std::string& sectionName);
+  template<typename T>
+  static T
+  parseNumber(const ConfigSection& node, const std::string& key, const std::string& sectionName)
+  {
+    static_assert(std::is_arithmetic<T>::value, "T must be an arithmetic type");
 
+    boost::optional<T> value = node.get_value_optional<T>();
+    if (value) {
+      return *value;
+    }
+    BOOST_THROW_EXCEPTION(Error("Invalid value \"" + node.get_value<std::string>() +
+                                "\" for option \"" + key + "\" in \"" + sectionName + "\" section"));
+  }
+
+  template <typename T>
+  static T
+  parseNumber(const ConfigSection::value_type& option, const std::string& sectionName)
+  {
+    return parseNumber<T>(option.second, option.first, sectionName);
+  }
+
+public: // setup and parsing
   /// \brief setup notification of configuration file sections
   void
   addSectionHandler(const std::string& sectionName,
@@ -146,22 +172,6 @@
   ConfigSection m_global;
 };
 
-template <typename T>
-inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type
-ConfigFile::parseNumber(const ConfigSection::value_type& option,
-                        const std::string& sectionName)
-{
-  auto value = option.second.get_value<std::string>();
-
-  try {
-    return boost::lexical_cast<T>(value);
-  }
-  catch (const boost::bad_lexical_cast&) {
-    BOOST_THROW_EXCEPTION(Error("Invalid value \"" + value + "\" for option \"" +
-                                option.first + "\" in \"" + sectionName + "\" section"));
-  }
-}
-
 } // namespace nfd
 
 #endif // NFD_CORE_CONFIG_FILE_HPP
diff --git a/daemon/mgmt/tables-config-section.cpp b/daemon/mgmt/tables-config-section.cpp
index 8422a5b..5095da8 100644
--- a/daemon/mgmt/tables-config-section.cpp
+++ b/daemon/mgmt/tables-config-section.cpp
@@ -24,9 +24,7 @@
  */
 
 #include "tables-config-section.hpp"
-
 #include "core/logger.hpp"
-#include "core/config-file.hpp"
 
 namespace nfd {
 
@@ -34,180 +32,113 @@
 
 const size_t TablesConfigSection::DEFAULT_CS_MAX_PACKETS = 65536;
 
-TablesConfigSection::TablesConfigSection(Cs& cs,
-                                         Pit& pit,
-                                         Fib& fib,
-                                         StrategyChoice& strategyChoice,
-                                         Measurements& measurements,
-                                         NetworkRegionTable& networkRegionTable)
-  : m_cs(cs)
-  // , m_pit(pit)
-  // , m_fib(fib)
-  , m_strategyChoice(strategyChoice)
-  // , m_measurements(measurements)
-  , m_networkRegionTable(networkRegionTable)
-  , m_areTablesConfigured(false)
+TablesConfigSection::TablesConfigSection(Forwarder& forwarder)
+  : m_forwarder(forwarder)
+  , m_isConfigured(false)
 {
-
 }
 
 void
 TablesConfigSection::setConfigFile(ConfigFile& configFile)
 {
   configFile.addSectionHandler("tables",
-                               bind(&TablesConfigSection::processConfig, this, _1, _2, _3));
+                               bind(&TablesConfigSection::processConfig, this, _1, _2));
 }
 
-
 void
-TablesConfigSection::ensureTablesAreConfigured()
+TablesConfigSection::ensureConfigured()
 {
-  if (m_areTablesConfigured) {
+  if (m_isConfigured) {
     return;
   }
 
   NFD_LOG_INFO("Setting CS max packets to " << DEFAULT_CS_MAX_PACKETS);
-  m_cs.setLimit(DEFAULT_CS_MAX_PACKETS);
+  m_forwarder.getCs().setLimit(DEFAULT_CS_MAX_PACKETS);
 
-  m_areTablesConfigured = true;
+  m_isConfigured = true;
 }
 
 void
-TablesConfigSection::processConfig(const ConfigSection& configSection,
-                                   bool isDryRun,
-                                   const std::string& filename)
+TablesConfigSection::processConfig(const ConfigSection& section, bool isDryRun)
 {
-  // tables
-  // {
-  //    cs_max_packets 65536
-  //
-  //    strategy_choice
-  //    {
-  //        /               /localhost/nfd/strategy/best-route
-  //        /localhost      /localhost/nfd/strategy/multicast
-  //        /localhost/nfd  /localhost/nfd/strategy/best-route
-  //        /ndn/broadcast  /localhost/nfd/strategy/multicast
-  //    }
-  //
-  //    network_region
-  //    {
-  //       /example/region1
-  //       /example/region2
-  //    }
-  // }
+  typedef boost::optional<const ConfigSection&> OptionalNode;
 
   size_t nCsMaxPackets = DEFAULT_CS_MAX_PACKETS;
-
-  boost::optional<const ConfigSection&> csMaxPacketsNode =
-    configSection.get_child_optional("cs_max_packets");
-
+  OptionalNode csMaxPacketsNode = section.get_child_optional("cs_max_packets");
   if (csMaxPacketsNode) {
-    boost::optional<size_t> valCsMaxPackets =
-      configSection.get_optional<size_t>("cs_max_packets");
-
-    if (!valCsMaxPackets) {
-      BOOST_THROW_EXCEPTION(ConfigFile::Error("Invalid value for option \"cs_max_packets\""
-                                              " in \"tables\" section"));
-    }
-
-    nCsMaxPackets = *valCsMaxPackets;
+    nCsMaxPackets = ConfigFile::parseNumber<size_t>(*csMaxPacketsNode, "cs_max_packets", "tables");
   }
 
-  boost::optional<const ConfigSection&> strategyChoiceSection =
-    configSection.get_child_optional("strategy_choice");
-
+  OptionalNode strategyChoiceSection = section.get_child_optional("strategy_choice");
   if (strategyChoiceSection) {
     processStrategyChoiceSection(*strategyChoiceSection, isDryRun);
   }
 
-  boost::optional<const ConfigSection&> networkRegionSection =
-    configSection.get_child_optional("network_region");
-
+  OptionalNode networkRegionSection = section.get_child_optional("network_region");
   if (networkRegionSection) {
     processNetworkRegionSection(*networkRegionSection, isDryRun);
   }
 
-  if (!isDryRun) {
-    NFD_LOG_INFO("Setting CS max packets to " << nCsMaxPackets);
-
-    m_cs.setLimit(nCsMaxPackets);
-    m_areTablesConfigured = true;
+  if (isDryRun) {
+    return;
   }
+
+  NFD_LOG_INFO("Setting CS max packets to " << nCsMaxPackets);
+  m_forwarder.getCs().setLimit(nCsMaxPackets);
+
+  m_isConfigured = true;
 }
 
 void
-TablesConfigSection::processStrategyChoiceSection(const ConfigSection& configSection,
-                                                  bool isDryRun)
+TablesConfigSection::processStrategyChoiceSection(const ConfigSection& section, bool isDryRun)
 {
-  // strategy_choice
-  // {
-  //   /               /localhost/nfd/strategy/best-route
-  //   /localhost      /localhost/nfd/strategy/multicast
-  //   /localhost/nfd  /localhost/nfd/strategy/best-route
-  //   /ndn/broadcast  /localhost/nfd/strategy/multicast
-  // }
+  StrategyChoice& sc = m_forwarder.getStrategyChoice();
 
   std::map<Name, Name> choices;
 
-  for (const auto& prefixAndStrategy : configSection) {
-    const Name prefix(prefixAndStrategy.first);
-    if (choices.find(prefix) != choices.end()) {
-      BOOST_THROW_EXCEPTION(ConfigFile::Error("Duplicate strategy choice for prefix \"" +
-                                              prefix.toUri() + "\" in \"strategy_choice\" "
-                                              "section"));
+  for (const auto& prefixAndStrategy : section) {
+    Name prefix(prefixAndStrategy.first);
+    Name strategy(prefixAndStrategy.second.get_value<std::string>());
+
+    if (!sc.hasStrategy(strategy)) {
+      BOOST_THROW_EXCEPTION(ConfigFile::Error(
+        "Unknown strategy \"" + prefixAndStrategy.second.get_value<std::string>() +
+        "\" for prefix \"" + prefix.toUri() + "\" in \"strategy_choice\" section"));
     }
 
-    const std::string strategyString(prefixAndStrategy.second.get_value<std::string>());
-    if (strategyString.empty()) {
-      BOOST_THROW_EXCEPTION(ConfigFile::Error("Invalid strategy choice \"\" for prefix \"" +
-                                              prefix.toUri() + "\" in \"strategy_choice\" "
-                                              "section"));
+    if (!choices.emplace(prefix, strategy).second) {
+      BOOST_THROW_EXCEPTION(ConfigFile::Error(
+        "Duplicate strategy choice for prefix \"" + prefix.toUri() +
+        "\" in \"strategy_choice\" section"));
     }
-
-    const Name strategyName(strategyString);
-    if (!m_strategyChoice.hasStrategy(strategyName)) {
-      BOOST_THROW_EXCEPTION(ConfigFile::Error("Invalid strategy choice \"" +
-                                              strategyName.toUri() + "\" for prefix \"" +
-                                              prefix.toUri() + "\" in \"strategy_choice\" "
-                                              "section"));
-    }
-
-    choices[prefix] = strategyName;
   }
 
+  if (isDryRun) {
+    return;
+  }
 
   for (const auto& prefixAndStrategy : choices) {
-    if (!isDryRun && !m_strategyChoice.insert(prefixAndStrategy.first, prefixAndStrategy.second)) {
-      BOOST_THROW_EXCEPTION(ConfigFile::Error("Failed to set strategy \"" +
-                                              prefixAndStrategy.second.toUri() + "\" for "
-                                              "prefix \"" + prefixAndStrategy.first.toUri() +
-                                              "\" in \"strategy_choicev\""));
+    if (!sc.insert(prefixAndStrategy.first, prefixAndStrategy.second)) {
+      BOOST_THROW_EXCEPTION(ConfigFile::Error(
+        "Failed to set strategy \"" + prefixAndStrategy.second.toUri() + "\" for "
+        "prefix \"" + prefixAndStrategy.first.toUri() + "\" in \"strategy_choicev\""));
     }
   }
 }
 
 void
-TablesConfigSection::processNetworkRegionSection(const ConfigSection& configSection,
-                                                 bool isDryRun)
+TablesConfigSection::processNetworkRegionSection(const ConfigSection& section, bool isDryRun)
 {
-  // network_region
-  // {
-  //    /example/region1
-  //    /example/region2
-  // }
-
-  if (!isDryRun) {
-    m_networkRegionTable.clear();
+  if (isDryRun) {
+    return;
   }
 
-  for (const auto& pair : configSection) {
-    const Name region(pair.first);
-
-    if (!isDryRun)  {
-      m_networkRegionTable.insert(region);
-    }
+  NetworkRegionTable& nrt = m_forwarder.getNetworkRegionTable();
+  nrt.clear();
+  for (const auto& pair : section) {
+    Name region(pair.first);
+    nrt.insert(region);
   }
 }
 
-
 } // namespace nfd
diff --git a/daemon/mgmt/tables-config-section.hpp b/daemon/mgmt/tables-config-section.hpp
index 82cb877..4aff010 100644
--- a/daemon/mgmt/tables-config-section.hpp
+++ b/daemon/mgmt/tables-config-section.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+ * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,67 +26,66 @@
 #ifndef NFD_MGMT_TABLES_CONFIG_SECTION_HPP
 #define NFD_MGMT_TABLES_CONFIG_SECTION_HPP
 
-#include "table/fib.hpp"
-#include "table/pit.hpp"
-#include "table/cs.hpp"
-#include "table/measurements.hpp"
-#include "table/network-region-table.hpp"
-#include "table/strategy-choice.hpp"
-
+#include "fw/forwarder.hpp"
 #include "core/config-file.hpp"
 
 namespace nfd {
 
-/**
- * \brief Provides parsing for `tables` configuration file section.
+/** \brief handles 'tables' config section
  *
- * This class enables configuration of CS, PIT, FIB, Strategy Choice, Measurements, and
- * Network Region tables.
+ *  This class recognizes a config section that looks like
+ *  \code{.unparsed}
+ *  tables
+ *  {
+ *    cs_max_packets 65536
+ *
+ *    strategy_choice
+ *    {
+ *      /               /localhost/nfd/strategy/best-route
+ *      /localhost      /localhost/nfd/strategy/multicast
+ *      /localhost/nfd  /localhost/nfd/strategy/best-route
+ *      /ndn/broadcast  /localhost/nfd/strategy/multicast
+ *    }
+ *
+ *    network_region
+ *    {
+ *      /example/region1
+ *      /example/region2
+ *    }
+ *  }
+ *  \endcode
  */
-class TablesConfigSection
+class TablesConfigSection : noncopyable
 {
 public:
-  TablesConfigSection(Cs& cs,
-                      Pit& pit,
-                      Fib& fib,
-                      StrategyChoice& strategyChoice,
-                      Measurements& measurements,
-                      NetworkRegionTable& networkRegionTable);
+  explicit
+  TablesConfigSection(Forwarder& forwarder);
 
   void
   setConfigFile(ConfigFile& configFile);
 
+  /** \brief apply default configuration, if tables section was omitted in configuration file
+   */
   void
-  ensureTablesAreConfigured();
+  ensureConfigured();
 
 private:
+  void
+  processConfig(const ConfigSection& section, bool isDryRun);
 
   void
-  processConfig(const ConfigSection& configSection,
-                bool isDryRun,
-                const std::string& filename);
+  processStrategyChoiceSection(const ConfigSection& section, bool isDryRun);
 
   void
-  processStrategyChoiceSection(const ConfigSection& configSection,
-                               bool isDryRun);
-
-  void
-  processNetworkRegionSection(const ConfigSection& configSection,
-                              bool isDryRun);
+  processNetworkRegionSection(const ConfigSection& section, bool isDryRun);
 
 private:
-  Cs& m_cs;
-  // Pit& m_pit;
-  // Fib& m_fib;
-  StrategyChoice& m_strategyChoice;
-  // Measurements& m_measurements;
-  NetworkRegionTable& m_networkRegionTable;
-
-  bool m_areTablesConfigured;
-
 private:
-
   static const size_t DEFAULT_CS_MAX_PACKETS;
+
+  Forwarder& m_forwarder;
+
+  bool m_isConfigured;
 };
 
 } // namespace nfd
diff --git a/daemon/nfd.cpp b/daemon/nfd.cpp
index 5d6bec7..b3369db 100644
--- a/daemon/nfd.cpp
+++ b/daemon/nfd.cpp
@@ -155,12 +155,7 @@
   ConfigFile config(&ignoreRibAndLogSections);
   general::setConfigFile(config);
 
-  TablesConfigSection tablesConfig(m_forwarder->getCs(),
-                                   m_forwarder->getPit(),
-                                   m_forwarder->getFib(),
-                                   m_forwarder->getStrategyChoice(),
-                                   m_forwarder->getMeasurements(),
-                                   m_forwarder->getNetworkRegionTable());
+  TablesConfigSection tablesConfig(*m_forwarder);
   tablesConfig.setConfigFile(config);
 
   m_authenticator->setConfigFile(config);
@@ -176,7 +171,7 @@
     config.parse(m_configSection, false, INTERNAL_CONFIG);
   }
 
-  tablesConfig.ensureTablesAreConfigured();
+  tablesConfig.ensureConfigured();
 
   // add FIB entry for NFD Management Protocol
   Name topPrefix("/localhost/nfd");
@@ -196,12 +191,7 @@
 
   general::setConfigFile(config);
 
-  TablesConfigSection tablesConfig(m_forwarder->getCs(),
-                                   m_forwarder->getPit(),
-                                   m_forwarder->getFib(),
-                                   m_forwarder->getStrategyChoice(),
-                                   m_forwarder->getMeasurements(),
-                                   m_forwarder->getNetworkRegionTable());
+  TablesConfigSection tablesConfig(*m_forwarder);
   tablesConfig.setConfigFile(config);
 
   m_authenticator->setConfigFile(config);
diff --git a/tests/daemon/mgmt/tables-config-section.t.cpp b/tests/daemon/mgmt/tables-config-section.t.cpp
index f3cf743..d87c6e6 100644
--- a/tests/daemon/mgmt/tables-config-section.t.cpp
+++ b/tests/daemon/mgmt/tables-config-section.t.cpp
@@ -44,7 +44,7 @@
     , m_strategyChoice(m_forwarder.getStrategyChoice())
     , m_measurements(m_forwarder.getMeasurements())
     , m_networkRegionTable(m_forwarder.getNetworkRegionTable())
-    , m_tablesConfig(m_cs, m_pit, m_fib, m_strategyChoice, m_measurements, m_networkRegionTable)
+    , m_tablesConfig(m_forwarder)
   {
     m_tablesConfig.setConfigFile(m_config);
   }
@@ -76,7 +76,7 @@
 {
   const size_t initialLimit = m_cs.getLimit();
 
-  m_tablesConfig.ensureTablesAreConfigured();
+  m_tablesConfig.ensureConfigured();
   BOOST_CHECK_NE(initialLimit, m_cs.getLimit());
 }
 
@@ -97,7 +97,7 @@
 
   const size_t defaultLimit = m_cs.getLimit();
 
-  m_tablesConfig.ensureTablesAreConfigured();
+  m_tablesConfig.ensureConfigured();
   BOOST_CHECK_EQUAL(defaultLimit, m_cs.getLimit());
 }
 
@@ -119,7 +119,7 @@
   passiveConfig.parse(CONFIG, false, "dummy-config");
   BOOST_REQUIRE_EQUAL(initialLimit, m_cs.getLimit());
 
-  m_tablesConfig.ensureTablesAreConfigured();
+  m_tablesConfig.ensureConfigured();
   BOOST_CHECK_NE(initialLimit, m_cs.getLimit());
 }
 
@@ -141,7 +141,7 @@
   BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, false));
   BOOST_CHECK_EQUAL(m_cs.getLimit(), 101);
 
-  m_tablesConfig.ensureTablesAreConfigured();
+  m_tablesConfig.ensureConfigured();
   BOOST_CHECK_EQUAL(m_cs.getLimit(), 101);
 }
 
@@ -371,7 +371,7 @@
 
 BOOST_AUTO_TEST_SUITE_END() // NetworkRegion
 
-BOOST_AUTO_TEST_SUITE_END() // TestTableConfigSection
+BOOST_AUTO_TEST_SUITE_END() // TestTablesConfigSection
 BOOST_AUTO_TEST_SUITE_END() // Mgmt
 
 } // namespace tests
