diff --git a/src/util/regex/regex-pattern-list-matcher.hpp b/src/util/regex/regex-pattern-list-matcher.hpp
index ccac4b8..7bf0366 100644
--- a/src/util/regex/regex-pattern-list-matcher.hpp
+++ b/src/util/regex/regex-pattern-list-matcher.hpp
@@ -24,14 +24,10 @@
 #ifndef NDN_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
 #define NDN_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
 
-#include "../../common.hpp"
-
 #include "regex-matcher.hpp"
 
 namespace ndn {
 
-class RegexBackrefManager;
-
 class RegexPatternListMatcher : public RegexMatcher
 {
 public:
@@ -45,24 +41,24 @@
   bool
   extractPattern(size_t index, size_t* next);
 
-  int
+  size_t
   extractSubPattern(const char left, const char right, size_t index);
 
-  int
+  size_t
   extractRepetition(size_t index);
 };
 
 } // namespace ndn
 
-#include "regex-repeat-matcher.hpp"
 #include "regex-backref-matcher.hpp"
+#include "regex-repeat-matcher.hpp"
 
 namespace ndn {
 
 inline
 RegexPatternListMatcher::RegexPatternListMatcher(const std::string& expr,
                                                  shared_ptr<RegexBackrefManager> backrefManager)
-  : RegexMatcher(expr, EXPR_PATTERN_LIST, backrefManager)
+  : RegexMatcher(expr, EXPR_PATTERN_LIST, std::move(backrefManager))
 {
   compile();
 }
@@ -78,7 +74,7 @@
     subHead = index;
 
     if (!extractPattern(subHead, &index))
-      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Compile error"));
+      BOOST_THROW_EXCEPTION(Error("Compile error"));
   }
 }
 
@@ -96,12 +92,11 @@
     indicator = index;
     end = extractRepetition(index);
     if (indicator == end) {
-      shared_ptr<RegexMatcher> matcher =
-        make_shared<RegexBackrefMatcher>(m_expr.substr(start, end - start), m_backrefManager);
+      auto matcher = make_shared<RegexBackrefMatcher>(m_expr.substr(start, end - start),
+                                                      m_backrefManager);
       m_backrefManager->pushRef(matcher);
-      dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
-
-      m_matchers.push_back(matcher);
+      matcher->lateCompile();
+      m_matchers.push_back(std::move(matcher));
     }
     else
       m_matchers.push_back(make_shared<RegexRepeatMatcher>(m_expr.substr(start, end - start),
@@ -127,24 +122,22 @@
     break;
 
   default:
-    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Unexpected syntax"));
+    BOOST_THROW_EXCEPTION(Error("Unexpected syntax"));
   }
 
   *next = end;
-
   return true;
 }
 
-inline int
+inline size_t
 RegexPatternListMatcher::extractSubPattern(const char left, const char right, size_t index)
 {
   size_t lcount = 1;
   size_t rcount = 0;
 
   while (lcount > rcount) {
-
     if (index >= m_expr.size())
-      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Parenthesis mismatch"));
+      BOOST_THROW_EXCEPTION(Error("Parenthesis mismatch"));
 
     if (left == m_expr[index])
       lcount++;
@@ -154,10 +147,11 @@
 
     index++;
   }
+
   return index;
 }
 
-inline int
+inline size_t
 RegexPatternListMatcher::extractRepetition(size_t index)
 {
   size_t exprSize = m_expr.size();
@@ -176,7 +170,7 @@
         break;
     }
     if (index == exprSize)
-      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Missing right brace bracket"));
+      BOOST_THROW_EXCEPTION(Error("Missing right brace bracket"));
     else
       return ++index;
   }
