diff --git a/src/security/v2/validation-policy-command-interest.cpp b/src/security/v2/validation-policy-command-interest.cpp
index d765e44..7e04bad 100644
--- a/src/security/v2/validation-policy-command-interest.cpp
+++ b/src/security/v2/validation-policy-command-interest.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "validation-policy-command-interest.hpp"
-#include "../pib/key.hpp"
 
 namespace ndn {
 namespace security {
@@ -37,7 +36,7 @@
   }
   setInnerPolicy(std::move(inner));
 
-  m_options.gracePeriod = std::max(m_options.gracePeriod, time::nanoseconds::zero());
+  m_options.gracePeriod = std::max(m_options.gracePeriod, 0_ns);
 }
 
 void
@@ -68,7 +67,7 @@
 void
 ValidationPolicyCommandInterest::cleanup()
 {
-  time::steady_clock::TimePoint expiring = time::steady_clock::now() - m_options.recordLifetime;
+  auto expiring = time::steady_clock::now() - m_options.recordLifetime;
 
   while ((!m_queue.empty() && m_queue.front().lastRefreshed <= expiring) ||
          (m_options.maxRecords >= 0 &&
@@ -109,33 +108,35 @@
 {
   this->cleanup();
 
-  time::system_clock::TimePoint now = time::system_clock::now();
-  time::system_clock::TimePoint timestampPoint = time::fromUnixTimestamp(time::milliseconds(timestamp));
+  auto now = time::system_clock::now();
+  auto timestampPoint = time::fromUnixTimestamp(time::milliseconds(timestamp));
   if (timestampPoint < now - m_options.gracePeriod || timestampPoint > now + m_options.gracePeriod) {
-    state->fail({ValidationError::POLICY_ERROR, "Timestamp is outside the grace period for key " + keyName.toUri()});
+    state->fail({ValidationError::POLICY_ERROR,
+                 "Timestamp is outside the grace period for key " + keyName.toUri()});
     return false;
   }
+
   auto it = m_index.find(keyName);
   if (it != m_index.end()) {
     if (timestamp <= it->timestamp) {
-      state->fail({ValidationError::POLICY_ERROR, "Timestamp is reordered for key " + keyName.toUri()});
+      state->fail({ValidationError::POLICY_ERROR,
+                   "Timestamp is reordered for key " + keyName.toUri()});
       return false;
     }
   }
 
-  shared_ptr<InterestValidationState> interestState = std::dynamic_pointer_cast<InterestValidationState>(state);
-  interestState->afterSuccess.connect(bind(&ValidationPolicyCommandInterest::insertNewRecord,
-                                           this, _1, keyName, timestamp));
+  auto interestState = dynamic_pointer_cast<InterestValidationState>(state);
+  BOOST_ASSERT(interestState != nullptr);
+  interestState->afterSuccess.connect([=] (const Interest&) { insertNewRecord(keyName, timestamp); });
   return true;
 }
 
 void
-ValidationPolicyCommandInterest::insertNewRecord(const Interest& interest, const Name& keyName,
-                                                 uint64_t timestamp)
+ValidationPolicyCommandInterest::insertNewRecord(const Name& keyName, uint64_t timestamp)
 {
   // try to insert new record
-  time::steady_clock::TimePoint now = time::steady_clock::now();
-  Queue::iterator i = m_queue.end();
+  auto now = time::steady_clock::now();
+  auto i = m_queue.end();
   bool isNew = false;
   LastTimestampRecord newRecord{keyName, timestamp, now};
   std::tie(i, isNew) = m_queue.push_back(newRecord);
diff --git a/src/security/v2/validation-policy-command-interest.hpp b/src/security/v2/validation-policy-command-interest.hpp
index 84a7be8..0630fa4 100644
--- a/src/security/v2/validation-policy-command-interest.hpp
+++ b/src/security/v2/validation-policy-command-interest.hpp
@@ -23,6 +23,7 @@
 #define NDN_SECURITY_V2_VALIDATION_POLICY_COMMAND_INTEREST_HPP
 
 #include "validation-policy.hpp"
+
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
@@ -122,11 +123,9 @@
                  const Name& keyName, uint64_t timestamp);
 
   void
-  insertNewRecord(const Interest& interest, const Name& keyName,
-                  uint64_t timestamp);
+  insertNewRecord(const Name& keyName, uint64_t timestamp);
 
 private:
-  unique_ptr<ValidationPolicy> m_innerPolicy;
   Options m_options;
 
   struct LastTimestampRecord
@@ -136,7 +135,7 @@
     time::steady_clock::TimePoint lastRefreshed;
   };
 
-  typedef boost::multi_index_container<
+  using Container = boost::multi_index_container<
     LastTimestampRecord,
     boost::multi_index::indexed_by<
       boost::multi_index::ordered_unique<
@@ -144,9 +143,9 @@
       >,
       boost::multi_index::sequenced<>
     >
-  > Container;
-  typedef Container::nth_index<0>::type Index;
-  typedef Container::nth_index<1>::type Queue;
+  >;
+  using Index = Container::nth_index<0>::type;
+  using Queue = Container::nth_index<1>::type;
 
   Container m_container;
   Index& m_index;
diff --git a/src/security/v2/validation-policy-config.cpp b/src/security/v2/validation-policy-config.cpp
index 0f0bb84..f6f6ed6 100644
--- a/src/security/v2/validation-policy-config.cpp
+++ b/src/security/v2/validation-policy-config.cpp
@@ -23,11 +23,13 @@
 #include "validator.hpp"
 #include "../../util/io.hpp"
 
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/predicate.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/property_tree/info_parser.hpp>
 
+#include <fstream>
+
 namespace ndn {
 namespace security {
 namespace v2 {
@@ -42,15 +44,11 @@
 void
 ValidationPolicyConfig::load(const std::string& filename)
 {
-  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) {
+    BOOST_THROW_EXCEPTION(Error("Failed to read configuration file: " + filename));
   }
   load(inputFile, filename);
-  inputFile.close();
 }
 
 void
@@ -67,26 +65,20 @@
   try {
     boost::property_tree::read_info(input, tree);
   }
-  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()));
+  catch (const boost::property_tree::info_parser_error& e) {
+    BOOST_THROW_EXCEPTION(Error("Failed to parse configuration file " + filename +
+                                " line " + to_string(e.line()) + ": " + e.message()));
   }
-
   load(tree, filename);
 }
 
 void
-ValidationPolicyConfig::load(const ConfigSection& configSection,
-                             const std::string& filename)
+ValidationPolicyConfig::load(const ConfigSection& configSection, const std::string& filename)
 {
   if (m_isConfigured) {
     m_shouldBypass = false;
     m_dataRules.clear();
     m_interestRules.clear();
-
     m_validator->resetAnchors();
     m_validator->resetVerifiedCertificates();
   }
@@ -95,11 +87,7 @@
   BOOST_ASSERT(!filename.empty());
 
   if (configSection.begin() == configSection.end()) {
-    std::string msg = "Error processing configuration file";
-    msg += ": ";
-    msg += filename;
-    msg += " no data";
-    BOOST_THROW_EXCEPTION(Error(msg));
+    BOOST_THROW_EXCEPTION(Error("Error processing configuration file " + filename + ": no data"));
   }
 
   for (const auto& subSection : configSection) {
@@ -119,21 +107,19 @@
       processConfigTrustAnchor(section, filename);
     }
     else {
-      std::string msg = "Error processing configuration file";
-      msg += " ";
-      msg += filename;
-      msg += " unrecognized section: " + sectionName;
-      BOOST_THROW_EXCEPTION(Error(msg));
+      BOOST_THROW_EXCEPTION(Error("Error processing configuration file " + filename +
+                                  ": unrecognized section " + sectionName));
     }
   }
 }
 
 void
-ValidationPolicyConfig::processConfigTrustAnchor(const ConfigSection& configSection, const std::string& filename)
+ValidationPolicyConfig::processConfigTrustAnchor(const ConfigSection& configSection,
+                                                 const std::string& filename)
 {
   using namespace boost::filesystem;
 
-  ConfigSection::const_iterator propertyIt = configSection.begin();
+  auto propertyIt = configSection.begin();
 
   // Get trust-anchor.type
   if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "type")) {
@@ -153,13 +139,11 @@
     propertyIt++;
 
     time::nanoseconds refresh = getRefreshPeriod(propertyIt, configSection.end());
-    if (propertyIt != configSection.end()) {
-      BOOST_THROW_EXCEPTION(Error("Expect the end of trust-anchor!"));
-    }
+    if (propertyIt != configSection.end())
+      BOOST_THROW_EXCEPTION(Error("Expecting end of <trust-anchor>"));
 
     m_validator->loadAnchor(filename, absolute(file, path(filename).parent_path()).string(),
                             refresh, false);
-    return;
   }
   else if (boost::iequals(type, "base64")) {
     // Get trust-anchor.base64-string
@@ -169,9 +153,8 @@
     std::stringstream ss(propertyIt->second.data());
     propertyIt++;
 
-    // Check other stuff
     if (propertyIt != configSection.end())
-      BOOST_THROW_EXCEPTION(Error("Expecting the end of trust-anchor"));
+      BOOST_THROW_EXCEPTION(Error("Expecting end of <trust-anchor>"));
 
     auto idCert = io::load<Certificate>(ss);
     if (idCert != nullptr) {
@@ -180,30 +163,26 @@
     else {
       BOOST_THROW_EXCEPTION(Error("Cannot decode certificate from base64-string"));
     }
-
-    return;
   }
   else if (boost::iequals(type, "dir")) {
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "dir"))
-      BOOST_THROW_EXCEPTION(Error("Expect <trust-anchor.dir>"));
+      BOOST_THROW_EXCEPTION(Error("Expecting <trust-anchor.dir>"));
 
     std::string dirString(propertyIt->second.data());
     propertyIt++;
 
     time::nanoseconds refresh = getRefreshPeriod(propertyIt, configSection.end());
-    if (propertyIt != configSection.end()) {
-      BOOST_THROW_EXCEPTION(Error("Expecting the end of trust-anchor"));
-    }
+    if (propertyIt != configSection.end())
+      BOOST_THROW_EXCEPTION(Error("Expecting end of <trust-anchor>"));
 
     path dirPath = absolute(dirString, path(filename).parent_path());
     m_validator->loadAnchor(dirString, dirPath.string(), refresh, true);
-    return;
   }
   else if (boost::iequals(type, "any")) {
     m_shouldBypass = true;
   }
   else {
-    BOOST_THROW_EXCEPTION(Error("Unsupported trust-anchor.type: " + type));
+    BOOST_THROW_EXCEPTION(Error("Unrecognized <trust-anchor.type>: " + type));
   }
 }
 
@@ -211,7 +190,7 @@
 ValidationPolicyConfig::getRefreshPeriod(ConfigSection::const_iterator& it,
                                          const ConfigSection::const_iterator& end)
 {
-  time::nanoseconds refresh = time::nanoseconds::max();
+  auto refresh = time::nanoseconds::max();
   if (it == end) {
     return refresh;
   }
@@ -222,17 +201,18 @@
 
   std::string inputString = it->second.data();
   ++it;
-
   char unit = inputString[inputString.size() - 1];
   std::string refreshString = inputString.substr(0, inputString.size() - 1);
 
-  uint32_t refreshPeriod = 0;
-
+  int32_t refreshPeriod = -1;
   try {
-    refreshPeriod = boost::lexical_cast<uint32_t>(refreshString);
+    refreshPeriod = boost::lexical_cast<int32_t>(refreshString);
   }
   catch (const boost::bad_lexical_cast&) {
-    BOOST_THROW_EXCEPTION(Error("Bad number: " + refreshString));
+    // pass
+  }
+  if (refreshPeriod < 0) {
+    BOOST_THROW_EXCEPTION(Error("Bad refresh value: " + refreshString));
   }
 
   if (refreshPeriod == 0) {
@@ -247,7 +227,7 @@
     case 's':
       return time::seconds(refreshPeriod);
     default:
-      BOOST_THROW_EXCEPTION(Error(std::string("Wrong time unit: ") + unit));
+      BOOST_THROW_EXCEPTION(Error(std::string("Bad refresh time unit: ") + unit));
   }
 }
 
@@ -282,7 +262,8 @@
     }
   }
 
-  return state->fail({ValidationError::POLICY_ERROR, "No rule matched for data `" + data.getName().toUri() + "`"});
+  return state->fail({ValidationError::POLICY_ERROR,
+                      "No rule matched for data `" + data.getName().toUri() + "`"});
 }
 
 void
@@ -310,7 +291,8 @@
     }
   }
 
-  return state->fail({ValidationError::POLICY_ERROR, "No rule matched for interest `" + interest.getName().toUri() + "`"});
+  return state->fail({ValidationError::POLICY_ERROR,
+                      "No rule matched for interest `" + interest.getName().toUri() + "`"});
 }
 
 } // namespace validator_config
diff --git a/src/security/v2/validator-config/checker.cpp b/src/security/v2/validator-config/checker.cpp
index dc4d49a..908e126 100644
--- a/src/security/v2/validator-config/checker.cpp
+++ b/src/security/v2/validator-config/checker.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,11 +23,8 @@
 #include "security/v2/validation-state.hpp"
 #include "security/verification-helpers.hpp"
 #include "security/pib/key.hpp"
-#include "util/logger.hpp"
 
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string/predicate.hpp>
 
 namespace ndn {
 namespace security {
@@ -35,7 +32,8 @@
 namespace validator_config {
 
 bool
-Checker::check(uint32_t pktType, const Name& pktName, const Name& klName, const shared_ptr<ValidationState>& state)
+Checker::check(uint32_t pktType, const Name& pktName, const Name& klName,
+               const shared_ptr<ValidationState>& state)
 {
   BOOST_ASSERT(pktType == tlv::Interest || pktType == tlv::Data);
 
@@ -57,7 +55,8 @@
 }
 
 bool
-NameRelationChecker::checkNames(const Name& pktName, const Name& klName, const shared_ptr<ValidationState>& state)
+NameRelationChecker::checkNames(const Name& pktName, const Name& klName,
+                                const shared_ptr<ValidationState>& state)
 {
   // pktName not used in this check
   Name identity = extractIdentityFromKeyName(klName);
@@ -87,7 +86,6 @@
        << " (KeyLocator=" << klName << ")";
     state->fail({ValidationError::POLICY_ERROR, os.str()});
   }
-
   return result;
 }
 
@@ -101,7 +99,8 @@
 }
 
 bool
-HyperRelationChecker::checkNames(const Name& pktName, const Name& klName, const shared_ptr<ValidationState>& state)
+HyperRelationChecker::checkNames(const Name& pktName, const Name& klName,
+                                 const shared_ptr<ValidationState>& state)
 {
   if (!m_hyperPRegex.match(pktName) || !m_hyperKRegex.match(klName)) {
     std::ostringstream os;
@@ -129,11 +128,10 @@
 
   // Get checker.type
   if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "type")) {
-    BOOST_THROW_EXCEPTION(Error("Expect <checker.type>"));
+    BOOST_THROW_EXCEPTION(Error("Expecting <checker.type>"));
   }
 
   std::string type = propertyIt->second.data();
-
   if (boost::iequals(type, "customized")) {
     return createCustomizedChecker(configSection, configFilename);
   }
@@ -141,13 +139,13 @@
     return createHierarchicalChecker(configSection, configFilename);
   }
   else {
-    BOOST_THROW_EXCEPTION(Error("Unsupported checker type: " + type));
+    BOOST_THROW_EXCEPTION(Error("Unrecognized <checker.type>: " + type));
   }
 }
 
 unique_ptr<Checker>
 Checker::createCustomizedChecker(const ConfigSection& configSection,
-                                        const std::string& configFilename)
+                                 const std::string& configFilename)
 {
   auto propertyIt = configSection.begin();
   propertyIt++;
@@ -161,22 +159,21 @@
 
   // Get checker.key-locator
   if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "key-locator")) {
-    BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator>"));
+    BOOST_THROW_EXCEPTION(Error("Expecting <checker.key-locator>"));
   }
 
   auto checker = createKeyLocatorChecker(propertyIt->second, configFilename);
   propertyIt++;
 
   if (propertyIt != configSection.end()) {
-    BOOST_THROW_EXCEPTION(Error("Expect the end of checker"));
+    BOOST_THROW_EXCEPTION(Error("Expecting end of <checker>"));
   }
-
   return checker;
 }
 
 unique_ptr<Checker>
 Checker::createHierarchicalChecker(const ConfigSection& configSection,
-                                          const std::string& configFilename)
+                                   const std::string& configFilename)
 {
   auto propertyIt = configSection.begin();
   propertyIt++;
@@ -189,54 +186,52 @@
   }
 
   if (propertyIt != configSection.end()) {
-    BOOST_THROW_EXCEPTION(Error("Expect the end of checker"));
+    BOOST_THROW_EXCEPTION(Error("Expecting end of <checker>"));
   }
-
   return make_unique<HyperRelationChecker>("^(<>*)$",        "\\1",
                                            "^(<>*)<KEY><>$", "\\1",
                                            NameRelation::IS_PREFIX_OF);
 }
 
-///
-
 unique_ptr<Checker>
-Checker::createKeyLocatorChecker(const ConfigSection& configSection, const std::string& configFilename)
+Checker::createKeyLocatorChecker(const ConfigSection& configSection,
+                                 const std::string& configFilename)
 {
   auto propertyIt = configSection.begin();
 
   // Get checker.key-locator.type
   if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "type"))
-    BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.type>"));
+    BOOST_THROW_EXCEPTION(Error("Expecting <checker.key-locator.type>"));
 
   std::string type = propertyIt->second.data();
-
   if (boost::iequals(type, "name"))
     return createKeyLocatorNameChecker(configSection, configFilename);
   else
-    BOOST_THROW_EXCEPTION(Error("Unsupported checker.key-locator.type: " + type));
+    BOOST_THROW_EXCEPTION(Error("Unrecognized <checker.key-locator.type>: " + type));
 }
 
 unique_ptr<Checker>
-Checker::createKeyLocatorNameChecker(const ConfigSection& configSection, const std::string& configFilename)
+Checker::createKeyLocatorNameChecker(const ConfigSection& configSection,
+                                     const std::string& configFilename)
 {
   auto propertyIt = configSection.begin();
   propertyIt++;
 
   if (propertyIt == configSection.end())
-    BOOST_THROW_EXCEPTION(Error("Expect more checker.key-locator properties"));
+    BOOST_THROW_EXCEPTION(Error("Unexpected end of <checker.key-locator>"));
 
   if (boost::iequals(propertyIt->first, "name")) {
     Name name;
     try {
       name = Name(propertyIt->second.data());
     }
-    catch (const Name::Error& e) {
-      BOOST_THROW_EXCEPTION(Error("Invalid checker.key-locator.name: " + propertyIt->second.data()));
+    catch (const Name::Error&) {
+      BOOST_THROW_EXCEPTION(Error("Invalid <checker.key-locator.name>: " + propertyIt->second.data()));
     }
     propertyIt++;
 
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "relation")) {
-      BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.relation>"));
+      BOOST_THROW_EXCEPTION(Error("Expecting <checker.key-locator.relation>"));
     }
 
     std::string relationString = propertyIt->second.data();
@@ -245,7 +240,7 @@
     NameRelation relation = getNameRelationFromString(relationString);
 
     if (propertyIt != configSection.end()) {
-      BOOST_THROW_EXCEPTION(Error("Expect the end of checker.key-locator"));
+      BOOST_THROW_EXCEPTION(Error("Expecting end of <checker.key-locator>"));
     }
     return make_unique<NameRelationChecker>(name, relation);
   }
@@ -254,24 +249,23 @@
     propertyIt++;
 
     if (propertyIt != configSection.end()) {
-      BOOST_THROW_EXCEPTION(Error("Expect the end of checker.key-locator"));
+      BOOST_THROW_EXCEPTION(Error("Expecting end of <checker.key-locator>"));
     }
 
     try {
       return make_unique<RegexChecker>(Regex(regexString));
     }
-    catch (const Regex::Error& e) {
-      BOOST_THROW_EXCEPTION(Error("Invalid checker.key-locator.regex: " + regexString));
+    catch (const Regex::Error&) {
+      BOOST_THROW_EXCEPTION(Error("Invalid <checker.key-locator.regex>: " + regexString));
     }
   }
   else if (boost::iequals(propertyIt->first, "hyper-relation")) {
     const ConfigSection& hSection = propertyIt->second;
-
     ConfigSection::const_iterator hPropertyIt = hSection.begin();
 
     // Get k-regex
     if (hPropertyIt == hSection.end() || !boost::iequals(hPropertyIt->first, "k-regex")) {
-      BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.hyper-relation.k-regex>"));
+      BOOST_THROW_EXCEPTION(Error("Expecting <checker.key-locator.hyper-relation.k-regex>"));
     }
 
     std::string kRegex = hPropertyIt->second.data();
@@ -279,7 +273,7 @@
 
     // Get k-expand
     if (hPropertyIt == hSection.end() || !boost::iequals(hPropertyIt->first, "k-expand")) {
-      BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.hyper-relation.k-expand>"));
+      BOOST_THROW_EXCEPTION(Error("Expecting <checker.key-locator.hyper-relation.k-expand>"));
     }
 
     std::string kExpand = hPropertyIt->second.data();
@@ -287,7 +281,7 @@
 
     // Get h-relation
     if (hPropertyIt == hSection.end() || !boost::iequals(hPropertyIt->first, "h-relation")) {
-      BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.hyper-relation.h-relation>"));
+      BOOST_THROW_EXCEPTION(Error("Expecting <checker.key-locator.hyper-relation.h-relation>"));
     }
 
     std::string hRelation = hPropertyIt->second.data();
@@ -295,7 +289,7 @@
 
     // Get p-regex
     if (hPropertyIt == hSection.end() || !boost::iequals(hPropertyIt->first, "p-regex")) {
-      BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.hyper-relation.p-regex>"));
+      BOOST_THROW_EXCEPTION(Error("Expecting <checker.key-locator.hyper-relation.p-regex>"));
     }
 
     std::string pRegex = hPropertyIt->second.data();
@@ -303,26 +297,26 @@
 
     // Get p-expand
     if (hPropertyIt == hSection.end() || !boost::iequals(hPropertyIt->first, "p-expand")) {
-      BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.hyper-relation.p-expand>"));
+      BOOST_THROW_EXCEPTION(Error("Expecting <checker.key-locator.hyper-relation.p-expand>"));
     }
 
     std::string pExpand = hPropertyIt->second.data();
     hPropertyIt++;
 
     if (hPropertyIt != hSection.end()) {
-      BOOST_THROW_EXCEPTION(Error("Expect the end of checker.key-locator.hyper-relation"));
+      BOOST_THROW_EXCEPTION(Error("Expecting end of <checker.key-locator.hyper-relation>"));
     }
 
     NameRelation relation = getNameRelationFromString(hRelation);
     try {
       return make_unique<HyperRelationChecker>(pRegex, pExpand, kRegex, kExpand, relation);
     }
-    catch (const Regex::Error& e) {
-      BOOST_THROW_EXCEPTION(Error("Invalid regex for key-locator.hyper-relation"));
+    catch (const Regex::Error&) {
+      BOOST_THROW_EXCEPTION(Error("Invalid regex for <key-locator.hyper-relation>"));
     }
   }
   else {
-    BOOST_THROW_EXCEPTION(Error("Unsupported checker.key-locator"));
+    BOOST_THROW_EXCEPTION(Error("Unrecognized <checker.key-locator>: " + propertyIt->first));
   }
 }
 
diff --git a/src/security/v2/validator-config/filter.cpp b/src/security/v2/validator-config/filter.cpp
index 1379c98..d9032c8 100644
--- a/src/security/v2/validator-config/filter.cpp
+++ b/src/security/v2/validator-config/filter.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,10 +23,10 @@
 
 #include "data.hpp"
 #include "interest.hpp"
-#include "util/regex.hpp"
 #include "security/security-common.hpp"
+#include "util/regex.hpp"
 
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/predicate.hpp>
 
 namespace ndn {
 namespace security {
@@ -78,15 +78,14 @@
   auto propertyIt = configSection.begin();
 
   if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "type")) {
-    BOOST_THROW_EXCEPTION(Error("Expect <filter.type>"));
+    BOOST_THROW_EXCEPTION(Error("Expecting <filter.type>"));
   }
 
   std::string type = propertyIt->second.data();
-
   if (boost::iequals(type, "name"))
     return createNameFilter(configSection, configFilename);
   else
-    BOOST_THROW_EXCEPTION(Error("Unsupported filter.type: " + type));
+    BOOST_THROW_EXCEPTION(Error("Unrecognized <filter.type>: " + type));
 }
 
 unique_ptr<Filter>
@@ -95,9 +94,8 @@
   auto propertyIt = configSection.begin();
   propertyIt++;
 
-  if (propertyIt == configSection.end()) {
-    BOOST_THROW_EXCEPTION(Error("Expect more properties for filter(name)"));
-  }
+  if (propertyIt == configSection.end())
+    BOOST_THROW_EXCEPTION(Error("Unexpected end of <filter>"));
 
   if (boost::iequals(propertyIt->first, "name")) {
     // Get filter.name
@@ -105,22 +103,22 @@
     try {
       name = Name(propertyIt->second.data());
     }
-    catch (const Name::Error& e) {
-      BOOST_THROW_EXCEPTION(Error("Wrong filter.name: " + propertyIt->second.data()));
+    catch (const Name::Error&) {
+      BOOST_THROW_EXCEPTION(Error("Invalid <filter.name>: " + propertyIt->second.data()));
     }
 
     propertyIt++;
 
     // Get filter.relation
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "relation")) {
-      BOOST_THROW_EXCEPTION(Error("Expect <filter.relation>"));
+      BOOST_THROW_EXCEPTION(Error("Expecting <filter.relation>"));
     }
 
     NameRelation relation = getNameRelationFromString(propertyIt->second.data());
     propertyIt++;
 
     if (propertyIt != configSection.end())
-      BOOST_THROW_EXCEPTION(Error("Expect the end of filter"));
+      BOOST_THROW_EXCEPTION(Error("Expecting end of <filter>"));
 
     return make_unique<RelationNameFilter>(name, relation);
   }
@@ -129,17 +127,17 @@
     propertyIt++;
 
     if (propertyIt != configSection.end())
-      BOOST_THROW_EXCEPTION(Error("Expect the end of filter"));
+      BOOST_THROW_EXCEPTION(Error("Expecting end of <filter>"));
 
     try {
       return make_unique<RegexNameFilter>(Regex(regexString));
     }
-    catch (const Regex::Error& e) {
-      BOOST_THROW_EXCEPTION(Error("Wrong filter.regex: " + regexString));
+    catch (const Regex::Error&) {
+      BOOST_THROW_EXCEPTION(Error("Invalid <filter.regex>: " + regexString));
     }
   }
   else {
-    BOOST_THROW_EXCEPTION(Error("Wrong filter(name) properties"));
+    BOOST_THROW_EXCEPTION(Error("Unrecognized <filter> property: " + propertyIt->first));
   }
 }
 
diff --git a/src/security/v2/validator-config/rule.cpp b/src/security/v2/validator-config/rule.cpp
index 93b8df4..2cc3124 100644
--- a/src/security/v2/validator-config/rule.cpp
+++ b/src/security/v2/validator-config/rule.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -73,7 +73,8 @@
 }
 
 bool
-Rule::check(uint32_t pktType, const Name& pktName, const Name& klName, const shared_ptr<ValidationState>& state) const
+Rule::check(uint32_t pktType, const Name& pktName, const Name& klName,
+            const shared_ptr<ValidationState>& state) const
 {
   NDN_LOG_TRACE("Trying to check " << pktName << " with keyLocator " << klName);
 
@@ -151,9 +152,8 @@
     hasCheckers = true;
   }
 
-  // Check other stuff
   if (propertyIt != configSection.end()) {
-    BOOST_THROW_EXCEPTION(Error("Expecting the end of rule: " + ruleId));
+    BOOST_THROW_EXCEPTION(Error("Expecting end of <rule>: " + ruleId));
   }
 
   if (!hasCheckers) {
