diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index 3b6285b..1b5dc61 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -255,60 +255,46 @@
     return false;
   }
 
-  try {
-    int32_t lsaRefreshTime = section.get<int32_t>("lsa-refresh-time");
-    if (lsaRefreshTime >= LSA_REFRESH_TIME_MIN &&
-        lsaRefreshTime <= LSA_REFRESH_TIME_MAX) {
-      m_nlsr.getConfParameter().setLsaRefreshTime(lsaRefreshTime);
-    }
-    else {
-      std::cerr << "Wrong value for lsa-refresh-time ";
-      std::cerr << "Allowed value: " << LSA_REFRESH_TIME_MIN << "-";;
-      std::cerr << LSA_REFRESH_TIME_MAX << std::endl;
-      return false;
-    }
+  // lsa-refresh-time
+  int32_t lsaRefreshTime = section.get<int32_t>("lsa-refresh-time", LSA_REFRESH_TIME_DEFAULT);
+
+  if (lsaRefreshTime >= LSA_REFRESH_TIME_MIN && lsaRefreshTime <= LSA_REFRESH_TIME_MAX) {
+    m_nlsr.getConfParameter().setLsaRefreshTime(lsaRefreshTime);
   }
-  catch (const std::exception& ex) {
-    std::cerr << ex.what() << std::endl;
+  else {
+    std::cerr << "Wrong value for lsa-refresh-time ";
+    std::cerr << "Allowed value: " << LSA_REFRESH_TIME_MIN << "-";;
+    std::cerr << LSA_REFRESH_TIME_MAX << std::endl;
+
+    return false;
+  }
+
+  // router-dead-interval
+  int32_t routerDeadInterval = section.get<int32_t>("router-dead-interval", (2*lsaRefreshTime));
+
+  if (routerDeadInterval > m_nlsr.getConfParameter().getLsaRefreshTime()) {
+    m_nlsr.getConfParameter().setRouterDeadInterval(routerDeadInterval);
+  }
+  else {
+    std::cerr << "Value of router-dead-interval must be larger than lsa-refresh-time" << std::endl;
+    return false;
+  }
+
+  // lsa-interest-lifetime
+  int lifetime = section.get<int>("lsa-interest-lifetime", LSA_INTEREST_LIFETIME_DEFAULT);
+
+  if (lifetime >= LSA_INTEREST_LIFETIME_MIN && lifetime <= LSA_INTEREST_LIFETIME_MAX) {
+    m_nlsr.getConfParameter().setLsaInterestLifetime(ndn::time::seconds(lifetime));
+  }
+  else {
+    std::cerr << "Wrong value for lsa-interest-timeout. "
+              << "Allowed value:" << LSA_INTEREST_LIFETIME_MIN << "-"
+              << LSA_INTEREST_LIFETIME_MAX << std::endl;
+
     return false;
   }
 
   try {
-    int32_t routerDeadInterval = section.get<int32_t>("router-dead-interval");
-
-    if (routerDeadInterval > m_nlsr.getConfParameter().getLsaRefreshTime()) {
-      m_nlsr.getConfParameter().setRouterDeadInterval(routerDeadInterval);
-    }
-    else {
-      std::cerr << "Value of router-dead-interval must be larger than lsa-refresh-time"
-                << std::endl;
-      return false;
-    }
-  }
-  catch (const std::exception& ex) {
-    // Variable is optional so default value (2 * lsa-refresh-time) will be used;
-    // Continue processing file
-  }
-
-  try {
-    int lifetime = section.get<int>("lsa-interest-lifetime");
-    if (lifetime >= LSA_INTEREST_LIFETIME_MIN && lifetime <= LSA_INTEREST_LIFETIME_MAX) {
-      m_nlsr.getConfParameter().setLsaInterestLifetime(ndn::time::seconds(lifetime));
-    }
-    else {
-      std::cerr << "Wrong value for lsa-interest-timeout. "
-                << "Allowed value:" << LSA_INTEREST_LIFETIME_MIN << "-"
-                << LSA_INTEREST_LIFETIME_MAX << std::endl;
-      return false;
-    }
-  }
-  catch (const std::exception& ex) {
-    std::cerr << ex.what() << std::endl;
-    // non-critical error. default value is 4
-  }
-
-  try {
-
     std::string logLevel = section.get<string>("log-level");
 
     if (isValidLogLevel(logLevel)) {
@@ -421,51 +407,46 @@
 bool
 ConfFileProcessor::processConfSectionNeighbors(const ConfigSection& section)
 {
-  try {
-    int retrials = section.get<int>("hello-retries");
-    if (retrials >= HELLO_RETRIES_MIN && retrials <= HELLO_RETRIES_MAX) {
-      m_nlsr.getConfParameter().setInterestRetryNumber(retrials);
-    }
-    else {
-      std::cerr << "Wrong value for hello-retries. ";
-      std::cerr << "Allowed value:" << HELLO_RETRIES_MIN << "-";
-      std::cerr << HELLO_RETRIES_MAX << std::endl;
-      return false;
-    }
+  // hello-retries
+  int retrials = section.get<int>("hello-retries", HELLO_RETRIES_DEFAULT);
+
+  if (retrials >= HELLO_RETRIES_MIN && retrials <= HELLO_RETRIES_MAX) {
+    m_nlsr.getConfParameter().setInterestRetryNumber(retrials);
   }
-  catch (const std::exception& ex) {
-    std::cerr << ex.what() << std::endl;
+  else {
+    std::cerr << "Wrong value for hello-retries." << std::endl;
+    std::cerr << "Allowed value:" << HELLO_RETRIES_MIN << "-";
+    std::cerr << HELLO_RETRIES_MAX << std::endl;
+
     return false;
   }
-  try {
-    int timeOut = section.get<int>("hello-timeout");
-    if (timeOut >= HELLO_TIMEOUT_MIN && timeOut <= HELLO_TIMEOUT_MAX) {
-      m_nlsr.getConfParameter().setInterestResendTime(timeOut);
-    }
-    else {
-      std::cerr << "Wrong value for hello-timeout. ";
-      std::cerr << "Allowed value:" << HELLO_TIMEOUT_MIN << "-";
-      std::cerr << HELLO_TIMEOUT_MAX << std::endl;
-      return false;
-    }
+
+  // hello-timeout
+  int timeOut = section.get<int>("hello-timeout", HELLO_TIMEOUT_DEFAULT);
+
+  if (timeOut >= HELLO_TIMEOUT_MIN && timeOut <= HELLO_TIMEOUT_MAX) {
+    m_nlsr.getConfParameter().setInterestResendTime(timeOut);
   }
-  catch (const std::exception& ex) {
-    std::cerr << ex.what() << std::endl;
+  else {
+    std::cerr << "Wrong value for hello-timeout. ";
+    std::cerr << "Allowed value:" << HELLO_TIMEOUT_MIN << "-";
+    std::cerr << HELLO_TIMEOUT_MAX << std::endl;
+
+    return false;
   }
-  try {
-    int interval = section.get<int>("hello-interval");
-    if (interval >= HELLO_INTERVAL_MIN && interval <= HELLO_INTERVAL_MAX) {
-      m_nlsr.getConfParameter().setInfoInterestInterval(interval);
-    }
-    else {
-      std::cerr << "Wrong value for hello-interval. ";
-      std::cerr << "Allowed value:" << HELLO_INTERVAL_MIN << "-";
-      std::cerr << HELLO_INTERVAL_MAX << std::endl;
-      return false;
-    }
+
+  // hello-interval
+  int interval = section.get<int>("hello-interval", HELLO_INTERVAL_DEFAULT);
+
+  if (interval >= HELLO_INTERVAL_MIN && interval <= HELLO_INTERVAL_MAX) {
+    m_nlsr.getConfParameter().setInfoInterestInterval(interval);
   }
-  catch (const std::exception& ex) {
-    std::cerr << ex.what() << std::endl;
+  else {
+    std::cerr << "Wrong value for hello-interval. ";
+    std::cerr << "Allowed value:" << HELLO_INTERVAL_MIN << "-";
+    std::cerr << HELLO_INTERVAL_MAX << std::endl;
+
+    return false;
   }
 
   // Event intervals
@@ -532,26 +513,22 @@
 bool
 ConfFileProcessor::processConfSectionHyperbolic(const ConfigSection& section)
 {
-  std::string state;
-  try {
-    state= section.get<string>("state","off");
-    if (boost::iequals(state, "off")) {
-      m_nlsr.getConfParameter().setHyperbolicState(HYPERBOLIC_STATE_OFF);
-    }
-    else if (boost::iequals(state, "on")) {
-        m_nlsr.getConfParameter().setHyperbolicState(HYPERBOLIC_STATE_ON);
-    }
-    else if (state == "dry-run") {
-      m_nlsr.getConfParameter().setHyperbolicState(HYPERBOLIC_STATE_DRY_RUN);
-    }
-    else {
-      std::cerr << "Wrong format for hyperbolic state." << std::endl;
-      std::cerr << "Allowed value: off, on, dry-run" << std::endl;
-      return false;
-    }
+  // state
+  std::string state = section.get<string>("state", "off");
+
+  if (boost::iequals(state, "off")) {
+    m_nlsr.getConfParameter().setHyperbolicState(HYPERBOLIC_STATE_OFF);
   }
-  catch (const std::exception& ex) {
-    std::cerr << ex.what() << std::endl;
+  else if (boost::iequals(state, "on")) {
+    m_nlsr.getConfParameter().setHyperbolicState(HYPERBOLIC_STATE_ON);
+  }
+  else if (state == "dry-run") {
+    m_nlsr.getConfParameter().setHyperbolicState(HYPERBOLIC_STATE_DRY_RUN);
+  }
+  else {
+    std::cerr << "Wrong format for hyperbolic state." << std::endl;
+    std::cerr << "Allowed value: off, on, dry-run" << std::endl;
+
     return false;
   }
 
@@ -581,22 +558,18 @@
 bool
 ConfFileProcessor::processConfSectionFib(const ConfigSection& section)
 {
-  try {
-    int maxFacesPerPrefixNumber =
-      section.get<int>("max-faces-per-prefix");
-    if (maxFacesPerPrefixNumber >= MAX_FACES_PER_PREFIX_MIN &&
-        maxFacesPerPrefixNumber <= MAX_FACES_PER_PREFIX_MAX)
-    {
-      m_nlsr.getConfParameter().setMaxFacesPerPrefix(maxFacesPerPrefixNumber);
-    }
-    else {
-      std::cerr << "Wrong value for max-faces-per-prefix. ";
-      std::cerr << MAX_FACES_PER_PREFIX_MIN << std::endl;
-      return false;
-    }
+  // max-faces-per-prefix
+  int maxFacesPerPrefix = section.get<int>("max-faces-per-prefix", MAX_FACES_PER_PREFIX_DEFAULT);
+
+  if (maxFacesPerPrefix >= MAX_FACES_PER_PREFIX_MIN &&
+      maxFacesPerPrefix <= MAX_FACES_PER_PREFIX_MAX)
+  {
+    m_nlsr.getConfParameter().setMaxFacesPerPrefix(maxFacesPerPrefix);
   }
-  catch (const std::exception& ex) {
-    cerr << ex.what() << endl;
+  else {
+    std::cerr << "Wrong value for max-faces-per-prefix. ";
+    std::cerr << MAX_FACES_PER_PREFIX_MIN << std::endl;
+
     return false;
   }
 
diff --git a/src/conf-parameter.hpp b/src/conf-parameter.hpp
index e25c4d3..4edf33e 100644
--- a/src/conf-parameter.hpp
+++ b/src/conf-parameter.hpp
@@ -83,13 +83,15 @@
 
 enum {
   MAX_FACES_PER_PREFIX_MIN = 0,
+  MAX_FACES_PER_PREFIX_DEFAULT = 0,
   MAX_FACES_PER_PREFIX_MAX = 60
 };
 
 enum {
   HYPERBOLIC_STATE_OFF = 0,
   HYPERBOLIC_STATE_ON = 1,
-  HYPERBOLIC_STATE_DRY_RUN = 2
+  HYPERBOLIC_STATE_DRY_RUN = 2,
+  HYPERBOLIC_STATE_DEFAULT = 0
 };
 
 class ConfParameter
@@ -189,7 +191,6 @@
   setLsaRefreshTime(int32_t lrt)
   {
     m_lsaRefreshTime = lrt;
-    m_routerDeadInterval = 2 * m_lsaRefreshTime;
   }
 
   int32_t
@@ -247,12 +248,12 @@
   }
 
   void
-  setRouterDeadInterval(int64_t rdt)
+  setRouterDeadInterval(int32_t rdt)
   {
     m_routerDeadInterval = rdt;
   }
 
-  int64_t
+  int32_t
   getRouterDeadInterval() const
   {
     return m_routerDeadInterval;
@@ -422,13 +423,12 @@
   uint32_t m_routingCalcInterval;
 
   ndn::time::seconds m_lsaInterestLifetime;
-  int64_t  m_routerDeadInterval;
+  int32_t  m_routerDeadInterval;
   std::string m_logLevel;
 
   uint32_t m_interestRetryNumber;
   int32_t  m_interestResendTime;
 
-
   int32_t  m_infoInterestInterval;
 
   int32_t m_hyperbolicState;
diff --git a/tests/test-conf-file-processor.cpp b/tests/test-conf-file-processor.cpp
index ab24215..a86a965 100644
--- a/tests/test-conf-file-processor.cpp
+++ b/tests/test-conf-file-processor.cpp
@@ -195,6 +195,12 @@
     return m_logFileName;
   }
 
+  void
+  commentOut(const std::string& key, std::string& config)
+  {
+    boost::replace_all(config, key, ";" + key);
+  }
+
 public:
   shared_ptr<ndn::DummyFace> face;
   Nlsr nlsr;
@@ -364,38 +370,75 @@
   BOOST_CHECK_EQUAL(conf.getCorTheta(), 1.45);
 }
 
-BOOST_AUTO_TEST_CASE(DefaultValues)
+BOOST_AUTO_TEST_CASE(DefaultValuesGeneral)
 {
-  // Missing adj-lsa-build-interval
-  const std::string SECTION_NEIGHBORS_DEFAULT_VALUES =
-  "neighbors\n"
-  "{\n"
-  "  hello-retries 3\n"
-  "  hello-timeout 1\n"
-  "  hello-interval  60\n\n"
-  "  first-hello-interval  6\n"
-  "  neighbor\n"
-  "  {\n"
-  "    name /ndn/memphis.edu/cs/castor\n"
-  "    face-uri  udp4://localhost\n"
-  "    link-cost 20\n"
-  "  }\n\n"
-  "  neighbor\n"
-  "  {\n"
-  "    name /ndn/memphis.edu/cs/mira\n"
-  "    face-uri  udp4://localhost\n"
-  "    link-cost 30\n"
-  "  }\n"
-  "}\n\n";
+  std::string config = SECTION_GENERAL;
 
-  processConfigurationString(SECTION_NEIGHBORS_DEFAULT_VALUES);
+  commentOut("lsa-refresh-time", config);
+  commentOut("lsa-interest-lifetime", config);
+  commentOut("router-dead-interval", config);
+
+  BOOST_CHECK_EQUAL(processConfigurationString(config), true);
 
   ConfParameter& conf = nlsr.getConfParameter();
 
+  BOOST_CHECK_EQUAL(conf.getLsaRefreshTime(), static_cast<int32_t>(LSA_REFRESH_TIME_DEFAULT));
+  BOOST_CHECK_EQUAL(conf.getLsaInterestLifetime(),
+                    static_cast<ndn::time::seconds>(LSA_INTEREST_LIFETIME_DEFAULT));
+  BOOST_CHECK_EQUAL(conf.getRouterDeadInterval(), (2*conf.getLsaRefreshTime()));
+}
+
+BOOST_AUTO_TEST_CASE(DefaultValuesNeighbors)
+{
+  std::string config = SECTION_NEIGHBORS;
+
+  commentOut("hello-retries", config);
+  commentOut("hello-timeout", config);
+  commentOut("hello-interval", config);
+  commentOut("first-hello-interval", config);
+  commentOut("adj-lsa-build-interval", config);
+
+  BOOST_CHECK_EQUAL(processConfigurationString(config), true);
+
+  ConfParameter& conf = nlsr.getConfParameter();
+
+  BOOST_CHECK_EQUAL(conf.getInterestRetryNumber(), static_cast<uint32_t>(HELLO_RETRIES_DEFAULT));
+  BOOST_CHECK_EQUAL(conf.getInterestResendTime(), static_cast<int32_t>(HELLO_TIMEOUT_DEFAULT));
+  BOOST_CHECK_EQUAL(conf.getInfoInterestInterval(), static_cast<int32_t>(HELLO_INTERVAL_DEFAULT));
+  BOOST_CHECK_EQUAL(conf.getFirstHelloInterval(),
+                    static_cast<uint32_t>(FIRST_HELLO_INTERVAL_DEFAULT));
   BOOST_CHECK_EQUAL(conf.getAdjLsaBuildInterval(),
                     static_cast<uint32_t>(ADJ_LSA_BUILD_INTERVAL_DEFAULT));
+}
 
-  BOOST_CHECK_EQUAL(conf.getFirstHelloInterval(), 6);
+BOOST_AUTO_TEST_CASE(DefaultValuesFib)
+{
+  std::string config = SECTION_FIB;
+
+  commentOut("max-faces-per-prefix", config);
+  commentOut("routing-calc-interval", config);
+
+  BOOST_CHECK_EQUAL(processConfigurationString(config), true);
+
+  ConfParameter& conf = nlsr.getConfParameter();
+
+  BOOST_CHECK_EQUAL(conf.getMaxFacesPerPrefix(),
+                    static_cast<uint32_t>(MAX_FACES_PER_PREFIX_DEFAULT));
+  BOOST_CHECK_EQUAL(conf.getRoutingCalcInterval(),
+                    static_cast<uint32_t>(ROUTING_CALC_INTERVAL_DEFAULT));
+}
+
+BOOST_AUTO_TEST_CASE(DefaultValuesHyperbolic)
+{
+  std::string config = SECTION_HYPERBOLIC_ON;
+
+  commentOut("state", config);
+
+  BOOST_CHECK_EQUAL(processConfigurationString(config), true);
+
+  ConfParameter& conf = nlsr.getConfParameter();
+
+  BOOST_CHECK_EQUAL(conf.getHyperbolicState(), static_cast<int32_t>(HYPERBOLIC_STATE_DEFAULT));
 }
 
 BOOST_AUTO_TEST_CASE(OutOfRangeValue)
