diff --git a/src/util/regex/regex-backref-manager.cpp b/src/util/regex/regex-backref-manager.cpp
deleted file mode 100644
index ed17250..0000000
--- a/src/util/regex/regex-backref-manager.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Yingdi Yu <yingdi@cs.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "regex-backref-manager.hpp"
-
-namespace ndn
-{
-
-RegexBackrefManager::~RegexBackrefManager()
-{ m_backRefs.clear(); }
-
-int 
-RegexBackrefManager::pushRef(ptr_lib::shared_ptr<RegexMatcher> matcher)
-{
-  int last = m_backRefs.size();
-  m_backRefs.push_back(matcher);
-
-  return last;
-}
-
-void
-RegexBackrefManager::popRef()
-{ m_backRefs.pop_back(); }
-
-}//ndn
diff --git a/src/util/regex/regex-backref-manager.hpp b/src/util/regex/regex-backref-manager.hpp
index 7604b42..bebaedb 100644
--- a/src/util/regex/regex-backref-manager.hpp
+++ b/src/util/regex/regex-backref-manager.hpp
@@ -5,14 +5,12 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NDN_REGEX_BACKREF_MANAGER_HPP
-#define NDN_REGEX_BACKREF_MANAGER_HPP
+#ifndef NDN_UTIL_REGEX_BACKREF_MANAGER_HPP
+#define NDN_UTIL_REGEX_BACKREF_MANAGER_HPP
 
-#include <vector>
 #include "../../common.hpp"
 
-namespace ndn
-{
+namespace ndn {
 
 class RegexMatcher;
 
@@ -24,23 +22,55 @@
   virtual ~RegexBackrefManager();
     
   int 
-  pushRef(ptr_lib::shared_ptr<RegexMatcher> matcher);
+  pushRef(shared_ptr<RegexMatcher> matcher);
     
   void 
   popRef();
 
   int 
-  size()
-  { return m_backRefs.size(); }
+  size();
     
-  ptr_lib::shared_ptr<RegexMatcher> 
-  getBackRef(int i)
-  { return m_backRefs[i]; }
+  shared_ptr<RegexMatcher> 
+  getBackRef(int i);
     
 private:
-  std::vector<ptr_lib::shared_ptr<RegexMatcher> > m_backRefs;
+  std::vector<shared_ptr<RegexMatcher> > m_backRefs;
 };
 
-}//ndn
 
-#endif
+inline RegexBackrefManager::~RegexBackrefManager()
+{
+  m_backRefs.clear();
+}
+
+inline int 
+RegexBackrefManager::pushRef(shared_ptr<RegexMatcher> matcher)
+{
+  int last = m_backRefs.size();
+  m_backRefs.push_back(matcher);
+
+  return last;
+}
+
+inline void
+RegexBackrefManager::popRef()
+{
+  m_backRefs.pop_back();
+}
+
+inline int 
+RegexBackrefManager::size()
+{
+  return m_backRefs.size();
+}
+    
+inline shared_ptr<RegexMatcher> 
+RegexBackrefManager::getBackRef(int i)
+{
+  return m_backRefs[i];
+}
+
+
+} // namespace ndn
+
+#endif // NDN_UTIL_REGEX_BACKREF_MANAGER_HPP
diff --git a/src/util/regex/regex-backref-matcher.cpp b/src/util/regex/regex-backref-matcher.cpp
deleted file mode 100644
index 1982623..0000000
--- a/src/util/regex/regex-backref-matcher.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Yingdi Yu <yingdi@cs.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include <boost/regex.hpp>
-
-#include "regex-backref-matcher.hpp"
-#include "regex-pattern-list-matcher.hpp"
-
-#include "../logging.hpp"
-
-INIT_LOGGER ("RegexBackrefMatcher");
-
-using namespace std;
-
-namespace ndn
-{
-
-RegexBackrefMatcher::RegexBackrefMatcher(const string expr, ptr_lib::shared_ptr<RegexBackrefManager> backRefManager)
-  : RegexMatcher (expr, EXPR_BACKREF, backRefManager)
-{
-  // _LOG_TRACE ("Enter RegexBackrefMatcher Constructor: ");
-  // compile();
-  // _LOG_TRACE ("Exit RegexBackrefMatcher Constructor: ");
-}
-
-void 
-RegexBackrefMatcher::compile()
-{
-  // _LOG_TRACE ("Enter RegexBackrefMatcher::compile()");
-
-  string errMsg = "Error: RegexBackrefMatcher.Compile(): ";
-    
-  // _LOG_DEBUG ("m_backRefManager: " << m_backRefManager);
-
-  int lastIndex = m_expr.size() - 1;
-  if('(' == m_expr[0] && ')' == m_expr[lastIndex]){
-    // m_backRefManager->pushRef(this);
-
-    ptr_lib::shared_ptr<RegexMatcher> matcher = ptr_lib::make_shared<RegexPatternListMatcher>(m_expr.substr(1, lastIndex - 1), m_backrefManager);
-    m_matcherList.push_back(matcher);
-      
-  }
-  else
-    throw RegexMatcher::Error(errMsg + " Unrecognoized format " + m_expr);
-    
-  // _LOG_TRACE ("Exit RegexBackrefMatcher::compile");
-}
-
-}//ndn
-
-
-
-
diff --git a/src/util/regex/regex-backref-matcher.hpp b/src/util/regex/regex-backref-matcher.hpp
index de04b19..5ae5f35 100644
--- a/src/util/regex/regex-backref-matcher.hpp
+++ b/src/util/regex/regex-backref-matcher.hpp
@@ -5,20 +5,19 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NDN_REGEX_BACKREF_MATCHER_HPP
-#define NDN_REGEX_BACKREF_MATCHER_HPP
+#ifndef NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
+#define NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
+
+#include "../../common.hpp"
 
 #include "regex-matcher.hpp"
 
-#include <boost/enable_shared_from_this.hpp>
-
-namespace ndn
-{
+namespace ndn {
 
 class RegexBackrefMatcher : public RegexMatcher
 {
 public:
-  RegexBackrefMatcher(const std::string expr, ptr_lib::shared_ptr<RegexBackrefManager> backRefManager);
+  RegexBackrefMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backRefManager);
     
   virtual ~RegexBackrefMatcher(){}
 
@@ -36,8 +35,36 @@
   int m_refNum;
 };
 
-}//ndn
+} // namespace ndn
 
-#endif
+#include "regex-pattern-list-matcher.hpp"
+
+namespace ndn {
+
+inline RegexBackrefMatcher::RegexBackrefMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backRefManager)
+  : RegexMatcher (expr, EXPR_BACKREF, backRefManager)
+{
+  // compile();
+}
+
+inline void 
+RegexBackrefMatcher::compile()
+{
+  int lastIndex = m_expr.size() - 1;
+  if('(' == m_expr[0] && ')' == m_expr[lastIndex]){
+    // m_backRefManager->pushRef(this);
+
+    shared_ptr<RegexMatcher> matcher(new RegexPatternListMatcher(m_expr.substr(1, lastIndex - 1), m_backrefManager));
+    m_matcherList.push_back(matcher);
+  }
+  else
+    throw RegexMatcher::Error(std::string("Error: RegexBackrefMatcher.Compile(): ")
+                              + " Unrecognoized format " + m_expr);
+}
+
+
+} // namespace ndn
+
+#endif // NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
 
 
diff --git a/src/util/regex/regex-component-matcher.cpp b/src/util/regex/regex-component-matcher.cpp
deleted file mode 100644
index e3bbe0e..0000000
--- a/src/util/regex/regex-component-matcher.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Yingdi Yu <yingdi@cs.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "regex-component-matcher.hpp"
-
-#include "../logging.hpp"
-
-INIT_LOGGER ("RegexComponentMatcher");
-
-using namespace std;
-
-namespace ndn
-{
-
-RegexComponentMatcher::RegexComponentMatcher (const string & expr, 
-                                              ptr_lib::shared_ptr<RegexBackrefManager> backRefManager, 
-                                              bool exact)
-  : RegexMatcher (expr, EXPR_COMPONENT, backRefManager),
-    m_exact(exact)
-{
-  // _LOG_TRACE ("Enter RegexComponentMatcher Constructor: ");
-  compile();
-  // _LOG_TRACE ("Exit RegexComponentMatcher Constructor: ");
-}
-
-void 
-RegexComponentMatcher::compile ()
-{
-  // _LOG_TRACE ("Enter RegexComponentMatcher::compile");
-
-  m_componentRegex = boost::regex (m_expr);
-
-  m_pseudoMatcher.clear();
-  m_pseudoMatcher.push_back(ptr_lib::make_shared<RegexPseudoMatcher>());
-
-  for (int i = 1; i < m_componentRegex.mark_count(); i++)
-    {
-      ptr_lib::shared_ptr<RegexPseudoMatcher> pMatcher = ptr_lib::make_shared<RegexPseudoMatcher>();
-      m_pseudoMatcher.push_back(pMatcher);
-      m_backrefManager->pushRef(ptr_lib::static_pointer_cast<RegexMatcher>(pMatcher));
-    }
-    
-
-  // _LOG_TRACE ("Exit RegexComponentMatcher::compile");
-}
-
-bool
-RegexComponentMatcher::match (const Name & name, const int & offset, const int & len)
-{
-  // _LOG_TRACE ("Enter RegexComponentMatcher::match ");
-
-  m_matchResult.clear();
-
-  if("" == m_expr)
-    {
-      m_matchResult.push_back(name.get(offset));
-      return true;
-    }
-
-  if(true == m_exact)
-    {
-      boost::smatch subResult;
-      string targetStr = name.get(offset).toEscapedString();
-      if(boost::regex_match(targetStr, subResult, m_componentRegex))
-        {
-          for (int i = 1; i < m_componentRegex.mark_count(); i++)
-            {
-              m_pseudoMatcher[i]->resetMatchResult();
-              m_pseudoMatcher[i]->setMatchResult(subResult[i]);
-            }
-          m_matchResult.push_back(name.get(offset));
-          return true;
-        }
-    }
-  else
-    {
-      throw RegexMatcher::Error("Non-exact component search is not supported yet!");
-    }
-
-  return false;
-}
-
-} //ndn
diff --git a/src/util/regex/regex-component-matcher.hpp b/src/util/regex/regex-component-matcher.hpp
index 830b45c..b102316 100644
--- a/src/util/regex/regex-component-matcher.hpp
+++ b/src/util/regex/regex-component-matcher.hpp
@@ -5,8 +5,8 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NDN_REGEX_COMPONENT_HPP
-#define NDN_REGEX_COMPONENT_HPP
+#ifndef NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
+#define NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
 
 #include <boost/regex.hpp>
 
@@ -14,8 +14,8 @@
 #include "regex-pseudo-matcher.hpp"
 
 
-namespace ndn
-{    
+namespace ndn {
+
 class RegexComponentMatcher : public RegexMatcher
 {
 public:
@@ -48,7 +48,78 @@
   std::vector<ptr_lib::shared_ptr<RegexPseudoMatcher> > m_pseudoMatcher;
     
 };
-    
-}//ndn
 
-#endif
+
+inline
+RegexComponentMatcher::RegexComponentMatcher (const std::string& expr, 
+                                              ptr_lib::shared_ptr<RegexBackrefManager> backRefManager, 
+                                              bool exact)
+  : RegexMatcher (expr, EXPR_COMPONENT, backRefManager),
+    m_exact(exact)
+{
+  // _LOG_TRACE ("Enter RegexComponentMatcher Constructor: ");
+  compile();
+  // _LOG_TRACE ("Exit RegexComponentMatcher Constructor: ");
+}
+
+inline void 
+RegexComponentMatcher::compile ()
+{
+  // _LOG_TRACE ("Enter RegexComponentMatcher::compile");
+
+  m_componentRegex = boost::regex (m_expr);
+
+  m_pseudoMatcher.clear();
+  m_pseudoMatcher.push_back(ptr_lib::make_shared<RegexPseudoMatcher>());
+
+  for (int i = 1; i < m_componentRegex.mark_count(); i++)
+    {
+      ptr_lib::shared_ptr<RegexPseudoMatcher> pMatcher = ptr_lib::make_shared<RegexPseudoMatcher>();
+      m_pseudoMatcher.push_back(pMatcher);
+      m_backrefManager->pushRef(ptr_lib::static_pointer_cast<RegexMatcher>(pMatcher));
+    }
+    
+
+  // _LOG_TRACE ("Exit RegexComponentMatcher::compile");
+}
+
+inline bool
+RegexComponentMatcher::match (const Name & name, const int & offset, const int & len)
+{
+  // _LOG_TRACE ("Enter RegexComponentMatcher::match ");
+
+  m_matchResult.clear();
+
+  if("" == m_expr)
+    {
+      m_matchResult.push_back(name.get(offset));
+      return true;
+    }
+
+  if(true == m_exact)
+    {
+      boost::smatch subResult;
+      std::string targetStr = name.get(offset).toEscapedString();
+      if(boost::regex_match(targetStr, subResult, m_componentRegex))
+        {
+          for (int i = 1; i < m_componentRegex.mark_count(); i++)
+            {
+              m_pseudoMatcher[i]->resetMatchResult();
+              m_pseudoMatcher[i]->setMatchResult(subResult[i]);
+            }
+          m_matchResult.push_back(name.get(offset));
+          return true;
+        }
+    }
+  else
+    {
+      throw RegexMatcher::Error("Non-exact component search is not supported yet!");
+    }
+
+  return false;
+}
+
+
+} // namespace ndn
+
+#endif // NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
diff --git a/src/util/regex/regex-component-set-matcher.cpp b/src/util/regex/regex-component-set-matcher.cpp
deleted file mode 100644
index dddebfc..0000000
--- a/src/util/regex/regex-component-set-matcher.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Yingdi Yu <yingdi@cs.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "regex-component-set-matcher.hpp"
-
-#include "../logging.hpp"
-
-INIT_LOGGER ("RegexComponentSetMatcher");
-
-using namespace std;
-
-namespace ndn
-{
-RegexComponentSetMatcher::RegexComponentSetMatcher(const string expr, ptr_lib::shared_ptr<RegexBackrefManager> backRefManager)
-  : RegexMatcher(expr, EXPR_COMPONENT_SET, backRefManager),
-    m_include(true)
-{
-  // _LOG_TRACE ("Enter RegexComponentSetMatcher Constructor");
-  compile();
-  // _LOG_TRACE ("Exit RegexComponentSetMatcher Constructor");
-}
-
-RegexComponentSetMatcher::~RegexComponentSetMatcher()
-{
-  // set<Ptr<RegexComponent> >::iterator it = m_components.begin();
-
-  // for(; it != m_components.end(); it++)
-  //   delete *it;
-}
-
-void 
-RegexComponentSetMatcher::compile()
-{
-  // _LOG_TRACE ("Enter RegexComponentSetMatcher::compile");
-
-  string errMsg = "Error: RegexComponentSetMatcher.compile(): ";
-  int index = 0;
-
-
-  switch(m_expr[0]){
-  case '<':
-    return compileSingleComponent();
-  case '[':
-    {
-      int lastIndex = m_expr.size() - 1;
-      if(']' != m_expr[lastIndex])
-        throw RegexMatcher::Error(errMsg + " No matched ']' " + m_expr);
-      
-      if('^' == m_expr[1]){
-        m_include = false;
-        compileMultipleComponents(2, lastIndex);
-      }
-      else
-        compileMultipleComponents(1, lastIndex);
-      break;
-    }
-  default:
-    throw RegexMatcher::Error(errMsg + "Parsing error in expr " + m_expr);
-  }
-
-  // _LOG_TRACE ("Exit RegexComponentSetMatcher::compile");
-}
-
-void 
-RegexComponentSetMatcher::compileSingleComponent()
-{
-  // _LOG_TRACE ("Enter RegexComponentSetMatcher::compileSingleComponent");
-
-  string errMsg = "Error: RegexComponentSetMatcher.compileSingleComponent: ";
-
-  int end = extractComponent(1);
-
-  if(m_expr.size() != end)
-    throw RegexMatcher::Error(errMsg + m_expr);
-  else{
-    // _LOG_DEBUG ("RegexComponentSetMatcher::compileSingleComponent expr: " << m_expr.substr(1, end - 2));
-    ptr_lib::shared_ptr<RegexComponentMatcher> component = ptr_lib::make_shared<RegexComponentMatcher>(m_expr.substr(1, end - 2), m_backrefManager);
-    m_components.insert(component);
-      
-  }
-
-  // _LOG_TRACE ("Exit RegexComponentSetMatcher::compileSingleComponent");
-}
-
-void 
-RegexComponentSetMatcher::compileMultipleComponents(const int start, const int lastIndex)
-{
-  // _LOG_TRACE ("Enter RegexComponentSetMatcher::compileMultipleComponents");
-
-  string errMsg = "Error: RegexComponentSetMatcher.compileMultipleComponents: ";
-
-  int index = start;
-  int tmp_index = start;
-    
-  while(index < lastIndex){
-    if('<' != m_expr[index])
-      throw RegexMatcher::Error(errMsg + "Component expr error " + m_expr);
-      
-    tmp_index = index + 1;
-    index = extractComponent(tmp_index);
-
-    ptr_lib::shared_ptr<RegexComponentMatcher> component = ptr_lib::make_shared<RegexComponentMatcher>(m_expr.substr(tmp_index, index - tmp_index - 1), m_backrefManager);
-    m_components.insert(component);
-  }
-    
-  if(index != lastIndex)
-    throw RegexMatcher::Error(errMsg + "Not sufficient expr to parse " + m_expr);        
-
-  // _LOG_TRACE ("Exit RegexComponentSetMatcher::compileMultipleComponents");
-}
-
-bool 
-RegexComponentSetMatcher::match(const Name & name, const int & offset, const int & len)
-{
-  // _LOG_TRACE ("Enter RegexComponentSetMatcher::match");
-
-  bool matched = false;
-
-  /* componentset only matches one component */
-  if(len != 1){
-    // _LOG_DEBUG ("Match Fail: ComponentSet matches only one component");
-    return false;
-  }
-
-  set<ptr_lib::shared_ptr<RegexComponentMatcher> >::iterator it = m_components.begin();
-
-  for(; it != m_components.end(); it++){
-    if((*it)->match(name, offset, len)){
-      matched = true;
-      break;
-    }
-  }
-    
-  m_matchResult.clear();
-
-  if(m_include ? matched : !matched){
-    m_matchResult.push_back(name.get(offset));
-    return true;
-  }
-  else 
-    return false;
-}
-
-int 
-RegexComponentSetMatcher::extractComponent(int index)
-{
-  // _LOG_TRACE ("Enter RegexComponentSetMatcher::extractComponent");
-
-  int lcount = 1;
-  int rcount = 0;
-
-  while(lcount > rcount){
-    switch(m_expr[index]){
-    case '<':
-      lcount++;
-      break;
-
-    case '>':
-      rcount++;
-      break;
-
-    case 0:
-      throw RegexMatcher::Error("Error: square brackets mismatch");
-      break;
-    }
-    index++;
-
-  }
-
-  // _LOG_TRACE ("Exit RegexComponentSetMatcher::extractComponent");
-  return index;
-
-}
-
-}//ndn
diff --git a/src/util/regex/regex-component-set-matcher.hpp b/src/util/regex/regex-component-set-matcher.hpp
index d4c576e..ffb4c6d 100644
--- a/src/util/regex/regex-component-set-matcher.hpp
+++ b/src/util/regex/regex-component-set-matcher.hpp
@@ -5,19 +5,17 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef REGEX_COMPONENT_SET_MATCHER_HPP
-#define REGEX_COMPONENT_SET_MATCHER_HPP
+#ifndef NDN_UTIL_REGEX_COMPONENT_SET_MATCHER_HPP
+#define NDN_UTIL_REGEX_COMPONENT_SET_MATCHER_HPP
 
-#include <set>
+#include "../../common.hpp"
 
 #include "regex-matcher.hpp"
 #include "regex-component-matcher.hpp"
 
-namespace ndn
-{
+namespace ndn {
 
-class RegexComponentSetMatcher : public RegexMatcher
-{
+class RegexComponentSetMatcher : public RegexMatcher {
 
 public:
   /**
@@ -26,12 +24,12 @@
    * @param exact The flag to provide exact match
    * @param backRefNum The starting back reference number
    */
-  RegexComponentSetMatcher(const std::string expr, ptr_lib::shared_ptr<RegexBackrefManager> backRefManager);    
+  RegexComponentSetMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backRefManager);    
 
   virtual ~RegexComponentSetMatcher();
 
   virtual bool 
-  match(const Name & name, const int & offset, const int & len = 1);
+  match(const Name& name, const int& offset, const int& len = 1);
 
 protected:    
   /**
@@ -52,10 +50,164 @@
   compileMultipleComponents(const int start, const int lastIndex);
 
 private:
-  std::set<ptr_lib::shared_ptr<RegexComponentMatcher> > m_components;
+  typedef std::set<shared_ptr<RegexComponentMatcher> > ComponentsSet;
+  ComponentsSet m_components;
   bool m_include;
 };
 
-}//ndn
 
-#endif
+inline
+RegexComponentSetMatcher::RegexComponentSetMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backRefManager)
+  : RegexMatcher(expr, EXPR_COMPONENT_SET, backRefManager),
+    m_include(true)
+{
+  // _LOG_TRACE ("Enter RegexComponentSetMatcher Constructor");
+  compile();
+  // _LOG_TRACE ("Exit RegexComponentSetMatcher Constructor");
+}
+
+inline
+RegexComponentSetMatcher::~RegexComponentSetMatcher()
+{
+  // ComponentsSet::iterator it = m_components.begin();
+
+  // for(; it != m_components.end(); it++)
+  //   delete *it;
+}
+
+inline void 
+RegexComponentSetMatcher::compile()
+{
+  int index = 0;
+
+  switch(m_expr[0]){
+  case '<':
+    return compileSingleComponent();
+  case '[':
+    {
+      int lastIndex = m_expr.size() - 1;
+      if(']' != m_expr[lastIndex])
+        throw RegexMatcher::Error(std::string("Error: RegexComponentSetMatcher.compile(): ")
+                                  + " No matched ']' " + m_expr);
+      
+      if('^' == m_expr[1]){
+        m_include = false;
+        compileMultipleComponents(2, lastIndex);
+      }
+      else
+        compileMultipleComponents(1, lastIndex);
+      break;
+    }
+  default:
+    throw RegexMatcher::Error(std::string("Error: RegexComponentSetMatcher.compile(): ")
+                              + "Parsing error in expr " + m_expr);
+  }
+}
+
+inline void 
+RegexComponentSetMatcher::compileSingleComponent()
+{
+  int end = extractComponent(1);
+
+  if(m_expr.size() != end)
+    {
+      throw RegexMatcher::Error(std::string("Error: RegexComponentSetMatcher.compileSingleComponent: ")
+                                + m_expr);
+    }
+  else
+    {
+      shared_ptr<RegexComponentMatcher> component =
+        make_shared<RegexComponentMatcher>(m_expr.substr(1, end - 2), m_backrefManager);
+      
+      m_components.insert(component);      
+    }
+}
+
+inline void 
+RegexComponentSetMatcher::compileMultipleComponents(const int start, const int lastIndex)
+{
+  int index = start;
+  int tmp_index = start;
+    
+  while(index < lastIndex){
+    if('<' != m_expr[index])
+      throw RegexMatcher::Error(std::string("Error: RegexComponentSetMatcher.compileMultipleComponents: ")
+                                + "Component expr error " + m_expr);
+      
+    tmp_index = index + 1;
+    index = extractComponent(tmp_index);
+
+    shared_ptr<RegexComponentMatcher> component =
+      make_shared<RegexComponentMatcher>(m_expr.substr(tmp_index, index - tmp_index - 1), m_backrefManager);
+    
+    m_components.insert(component);
+  }
+    
+  if(index != lastIndex)
+    throw RegexMatcher::Error(std::string("Error: RegexComponentSetMatcher.compileMultipleComponents: ")
+                              + "Not sufficient expr to parse " + m_expr);        
+}
+
+inline bool 
+RegexComponentSetMatcher::match(const Name & name, const int & offset, const int & len)
+{
+  bool matched = false;
+
+  /* componentset only matches one component */
+  if (len != 1)
+    {
+      return false;
+    }
+
+  for (ComponentsSet::iterator it = m_components.begin();
+       it != m_components.end();
+       ++it)
+    {
+      if((*it)->match(name, offset, len))
+        {
+          matched = true;
+          break;
+        }
+    }
+    
+  m_matchResult.clear();
+
+  if (m_include ? matched : !matched)
+    {
+      m_matchResult.push_back(name.get(offset));
+      return true;
+    }
+  else 
+    return false;
+}
+
+inline int 
+RegexComponentSetMatcher::extractComponent(int index)
+{
+  int lcount = 1;
+  int rcount = 0;
+
+  while(lcount > rcount){
+    switch(m_expr[index]){
+    case '<':
+      lcount++;
+      break;
+
+    case '>':
+      rcount++;
+      break;
+
+    case 0:
+      throw RegexMatcher::Error("Error: square brackets mismatch");
+      break;
+    }
+    index++;
+
+  }
+
+  return index;
+}
+
+} // namespace ndn
+
+#endif // NDN_UTIL_REGEX_COMPONENT_SET_MATCHER_HPP
diff --git a/src/util/regex/regex-matcher.cpp b/src/util/regex/regex-matcher.cpp
deleted file mode 100644
index b83aa2e..0000000
--- a/src/util/regex/regex-matcher.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Yingdi Yu <yingdi@cs.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "regex-matcher.hpp"
-
-#include "../logging.hpp"
-
-INIT_LOGGER ("RegexMatcher");
-
-using namespace std;
-
-namespace ndn
-{
-RegexMatcher::RegexMatcher(const std::string& expr, 
-                           const RegexExprType& type,  
-                           ptr_lib::shared_ptr<RegexBackrefManager> backrefManager) 
-  : m_expr(expr), 
-    m_type(type),
-    m_backrefManager(backrefManager)
-{
-  if(NULL == m_backrefManager)
-    m_backrefManager = ptr_lib::shared_ptr<RegexBackrefManager>(new RegexBackrefManager);
-}
-
-RegexMatcher::~RegexMatcher()
-{}
-
-bool 
-RegexMatcher::match (const Name& name, const int& offset, const int& len)
-{
-  // _LOG_TRACE ("Enter RegexMatcher::match");
-  bool result = false;
-
-  m_matchResult.clear();
-
-  if(recursiveMatch(0, name, offset, len))
-    {
-      for(int i = offset; i < offset + len ; i++)
-        m_matchResult.push_back(name.get(i));
-      result = true;
-    }
-  else
-    {
-      result = false;
-    }
-
-  // _LOG_TRACE ("Exit RegexMatcher::match");
-  return result;
-}
-  
-bool 
-RegexMatcher::recursiveMatch(const int& mId, const Name& name, const int& offset, const int& len)
-{
-  // _LOG_TRACE ("Enter RegexMatcher::recursiveMatch");
-
-  int tried = len;
-
-  if(mId >= m_matcherList.size())
-    return (len != 0 ? false : true);
-    
-  ptr_lib::shared_ptr<RegexMatcher> matcher = m_matcherList[mId];
-
-  while(tried >= 0)
-    {
-      if(matcher->match(name, offset, tried) && recursiveMatch(mId + 1, name, offset + tried, len - tried))
-        return true;      
-      tried--;
-    }
-
-  return false;
-}
-
-}//ndn
-
diff --git a/src/util/regex/regex-matcher.hpp b/src/util/regex/regex-matcher.hpp
index ba465ac..baa8bf3 100644
--- a/src/util/regex/regex-matcher.hpp
+++ b/src/util/regex/regex-matcher.hpp
@@ -5,22 +5,20 @@
  * See COPYING for copyright and distribution information.
  */
 
+#ifndef NDN_UTIL_REGEX_REGEX_MATCHER_H
+#define NDN_UTIL_REGEX_REGEX_MATCHER_H
 
-#ifndef NDN_REGEX_MATCHER_H
-#define NDN_REGEX_MATCHER_H
-
-#include <string>
+#include "../../common.hpp"
 #include "../../name.hpp"
-#include "regex-backref-manager.hpp"
 
-namespace ndn
-{
-class RegexMatcher;
+namespace ndn {
+
+class RegexBackrefManager;
 
 class RegexMatcher
 {
 public:
-  struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
+  struct Error : public std::runtime_error { Error(const std::string& what) : std::runtime_error(what) {} };
 
   enum RegexExprType{
     EXPR_TOP,
@@ -38,7 +36,7 @@
 
   RegexMatcher(const std::string& expr, 
                const RegexExprType& type,  
-               ptr_lib::shared_ptr<RegexBackrefManager> backrefManager = ptr_lib::shared_ptr<RegexBackrefManager>());
+               shared_ptr<RegexBackrefManager> backrefManager = shared_ptr<RegexBackrefManager>());
 
   virtual 
   ~RegexMatcher();
@@ -50,7 +48,7 @@
    * @brief get the matched name components
    * @returns the matched name components
    */
-  const std::vector<Name::Component>& 
+  const std::vector<name::Component>& 
   getMatchResult() const
   { return m_matchResult; }
 
@@ -74,12 +72,81 @@
 protected:
   const std::string m_expr;
   const RegexExprType m_type; 
-  ptr_lib::shared_ptr<RegexBackrefManager> m_backrefManager;
-  std::vector<ptr_lib::shared_ptr<RegexMatcher> > m_matcherList;
-  std::vector<Name::Component> m_matchResult;
-
+  shared_ptr<RegexBackrefManager> m_backrefManager;
+  std::vector<shared_ptr<RegexMatcher> > m_matcherList;
+  std::vector<name::Component> m_matchResult;
 };
-}//ndn
+
+} // namespace ndn
+
+#include "regex-backref-manager.hpp"
+
+namespace ndn {
+
+inline
+RegexMatcher::RegexMatcher(const std::string& expr, 
+                           const RegexExprType& type,  
+                           shared_ptr<RegexBackrefManager> backrefManager) 
+  : m_expr(expr), 
+    m_type(type),
+    m_backrefManager(backrefManager)
+{
+  if(NULL == m_backrefManager)
+    m_backrefManager = make_shared<RegexBackrefManager>();
+}
+
+inline
+RegexMatcher::~RegexMatcher()
+{
+}
+
+inline bool 
+RegexMatcher::match (const Name& name, const int& offset, const int& len)
+{
+  // _LOG_TRACE ("Enter RegexMatcher::match");
+  bool result = false;
+
+  m_matchResult.clear();
+
+  if(recursiveMatch(0, name, offset, len))
+    {
+      for(int i = offset; i < offset + len ; i++)
+        m_matchResult.push_back(name.get(i));
+      result = true;
+    }
+  else
+    {
+      result = false;
+    }
+
+  // _LOG_TRACE ("Exit RegexMatcher::match");
+  return result;
+}
+  
+inline bool 
+RegexMatcher::recursiveMatch(const int& mId, const Name& name, const int& offset, const int& len)
+{
+  // _LOG_TRACE ("Enter RegexMatcher::recursiveMatch");
+
+  int tried = len;
+
+  if(mId >= m_matcherList.size())
+    return (len != 0 ? false : true);
+    
+  shared_ptr<RegexMatcher> matcher = m_matcherList[mId];
+
+  while(tried >= 0)
+    {
+      if(matcher->match(name, offset, tried) && recursiveMatch(mId + 1, name, offset + tried, len - tried))
+        return true;      
+      tried--;
+    }
+
+  return false;
+}
 
 
-#endif
+} // namespace ndn
+
+
+#endif // NDN_UTIL_REGEX_REGEX_MATCHER_H
diff --git a/src/util/regex/regex-pattern-list-matcher.cpp b/src/util/regex/regex-pattern-list-matcher.cpp
deleted file mode 100644
index 28f0037..0000000
--- a/src/util/regex/regex-pattern-list-matcher.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Yingdi Yu <yingdi@cs.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "regex-pattern-list-matcher.hpp"
-#include "regex-backref-matcher.hpp"
-#include "regex-repeat-matcher.hpp"
-
-#include "../logging.hpp"
-
-INIT_LOGGER ("RegexPatternListMatcher");
-
-using namespace std;
-
-namespace ndn
-{
-RegexPatternListMatcher::RegexPatternListMatcher(const string expr, ptr_lib::shared_ptr<RegexBackrefManager> backrefManager)
-  :RegexMatcher(expr, EXPR_PATTERNLIST, backrefManager)
-{
-  // _LOG_TRACE ("Enter RegexPatternListMatcher Constructor");
-  compile();
-  // _LOG_TRACE ("Exit RegexPatternListMatcher Constructor");
-}
-  
-void 
-RegexPatternListMatcher::compile()
-{
-  // _LOG_TRACE ("Enter RegexPatternListMatcher::compile");
-
-  const int len = m_expr.size();
-  int index = 0;
-  int subHead = index;
-    
-  while(index < len){
-    subHead = index;
-
-    if(!extractPattern(subHead, &index))
-      throw RegexMatcher::Error("RegexPatternListMatcher compile: cannot compile");
-  }
-  // _LOG_TRACE ("Exit RegexPatternListMatcher::compile");
-}
-
-bool 
-RegexPatternListMatcher::extractPattern(int index, int* next)
-{
-  // _LOG_DEBUG ("Enter RegexPatternListMatcher::ExtractPattern()");
-
-  string errMsg = "Error: RegexPatternListMatcher.ExtractSubPattern(): ";
-    
-  const int start = index;
-  int end = index;
-  int indicator = index;
-    
-
-  // _LOG_DEBUG ("m_expr: " << m_expr << " index: " << index);
-
-  switch(m_expr[index]){
-  case '(':
-    index++;
-    index = extractSubPattern('(', ')', index);
-    indicator = index;
-    end = extractRepetition(index);
-    if(indicator == end){
-      ptr_lib::shared_ptr<RegexMatcher> matcher = ptr_lib::make_shared<RegexBackrefMatcher>(m_expr.substr(start, end - start), m_backrefManager);
-      m_backrefManager->pushRef(matcher);
-      boost::dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
-
-      m_matcherList.push_back(matcher);
-    }
-    else
-      m_matcherList.push_back(ptr_lib::make_shared<RegexRepeatMatcher>(m_expr.substr(start, end - start), m_backrefManager, indicator - start));
-    break;
-      
-  case '<':
-    index++;
-    index = extractSubPattern ('<', '>', index);
-    indicator = index;
-    end = extractRepetition(index);
-    m_matcherList.push_back(ptr_lib::make_shared<RegexRepeatMatcher>(m_expr.substr(start, end - start), m_backrefManager, indicator - start));
-    break;
-
-  case '[':
-    index++;
-    index = extractSubPattern ('[', ']', index);
-    indicator = index;
-    end = extractRepetition(index);
-    m_matcherList.push_back(ptr_lib::make_shared<RegexRepeatMatcher>(m_expr.substr(start, end - start), m_backrefManager, indicator - start));
-    break;
-
-  default:
-    throw RegexMatcher::Error("Error: unexpected syntax");
-  }
-
-  *next = end;
-
-  return true;
-}
-  
-int 
-RegexPatternListMatcher::extractSubPattern(const char left, const char right, int index)
-{
-  // _LOG_DEBUG ("Enter RegexPatternListMatcher::ExtractSubPattern()");
-
-  int lcount = 1;
-  int rcount = 0;
-
-  while(lcount > rcount){
-
-    if(index >= m_expr.size())
-      throw RegexMatcher::Error("Error: parenthesis mismatch");
-
-    if(left == m_expr[index])
-      lcount++;
-
-    if(right == m_expr[index])
-      rcount++;
-
-    index++;
-  }
-  return index;
-}
-
-int 
-RegexPatternListMatcher::extractRepetition(int index)
-{
-  // _LOG_DEBUG ("Enter RegexPatternListMatcher::ExtractRepetition()");
-
-  int exprSize = m_expr.size();
-
-  // _LOG_DEBUG ("expr: " << m_expr << " index: " << index << " char: " << (index == exprSize ? 0 : m_expr[index]));
-
-  string errMsg = "Error: RegexPatternListMatcher.ExtractRepetition(): ";
-    
-  if(index == exprSize)
-    return index;
-    
-  if(('+' == m_expr[index] || '?' == m_expr[index] || '*' == m_expr[index])){
-    return ++index;
-  }
-
-    
-  if('{' == m_expr[index]){
-    while('}' != m_expr[index]){
-      index++;
-      if(index == exprSize)
-        break;
-    }
-    if(index == exprSize)
-      throw RegexMatcher::Error(errMsg + "Missing right brace bracket");
-    else
-      return ++index;
-  }
-  else{
-    // _LOG_DEBUG ("return index: " << index);
-    return index;
-  }
-}
-
-}//ndn
diff --git a/src/util/regex/regex-pattern-list-matcher.hpp b/src/util/regex/regex-pattern-list-matcher.hpp
index 7240905..84b5c46 100644
--- a/src/util/regex/regex-pattern-list-matcher.hpp
+++ b/src/util/regex/regex-pattern-list-matcher.hpp
@@ -5,20 +5,21 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NDN_REGEX_PATTERN_LIST_MATCHER_HPP
-#define NDN_REGEX_PATTERN_LIST_MATCHER_HPP
+#ifndef NDN_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
+#define NDN_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
 
-#include <string>
+#include "../../common.hpp"
 
 #include "regex-matcher.hpp"
 
-namespace ndn
-{
+namespace ndn {
+
+class RegexBackrefManager;
 
 class RegexPatternListMatcher : public RegexMatcher
 {
 public:
-  RegexPatternListMatcher(const std::string expr, ptr_lib::shared_ptr<RegexBackrefManager> backRefManager);
+  RegexPatternListMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backRefManager);
     
   virtual ~RegexPatternListMatcher(){};
 
@@ -39,6 +40,138 @@
 private:
 
 };
-}//ndn
 
-#endif
+} // namespace ndn
+
+#include "regex-repeat-matcher.hpp"
+#include "regex-backref-matcher.hpp"
+
+namespace ndn {
+
+inline RegexPatternListMatcher::RegexPatternListMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backrefManager)
+  :RegexMatcher(expr, EXPR_PATTERNLIST, backrefManager)
+{
+  compile();
+}
+  
+inline void 
+RegexPatternListMatcher::compile()
+{
+  const int len = m_expr.size();
+  int index = 0;
+  int subHead = index;
+    
+  while(index < len){
+    subHead = index;
+
+    if(!extractPattern(subHead, &index))
+      throw RegexMatcher::Error("RegexPatternListMatcher compile: cannot compile");
+  }
+}
+
+inline bool 
+RegexPatternListMatcher::extractPattern(int index, int* next)
+{
+  // std::string errMsg = "Error: RegexPatternListMatcher.ExtractSubPattern(): ";
+    
+  const int start = index;
+  int end = index;
+  int indicator = index;
+
+  switch(m_expr[index]){
+  case '(':
+    index++;
+    index = extractSubPattern('(', ')', index);
+    indicator = index;
+    end = extractRepetition(index);
+    if(indicator == end){
+      shared_ptr<RegexMatcher> matcher = make_shared<RegexBackrefMatcher>(m_expr.substr(start, end - start), m_backrefManager);
+      m_backrefManager->pushRef(matcher);
+      boost::dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
+
+      m_matcherList.push_back(matcher);
+    }
+    else
+      m_matcherList.push_back(make_shared<RegexRepeatMatcher>(m_expr.substr(start, end - start), m_backrefManager, indicator - start));
+    break;
+      
+  case '<':
+    index++;
+    index = extractSubPattern ('<', '>', index);
+    indicator = index;
+    end = extractRepetition(index);
+    m_matcherList.push_back(make_shared<RegexRepeatMatcher>(m_expr.substr(start, end - start), m_backrefManager, indicator - start));
+    break;
+
+  case '[':
+    index++;
+    index = extractSubPattern ('[', ']', index);
+    indicator = index;
+    end = extractRepetition(index);
+    m_matcherList.push_back(make_shared<RegexRepeatMatcher>(m_expr.substr(start, end - start), m_backrefManager, indicator - start));
+    break;
+
+  default:
+    throw RegexMatcher::Error("Error: unexpected syntax");
+  }
+
+  *next = end;
+
+  return true;
+}
+  
+inline int 
+RegexPatternListMatcher::extractSubPattern(const char left, const char right, int index)
+{
+  int lcount = 1;
+  int rcount = 0;
+
+  while(lcount > rcount){
+
+    if(index >= m_expr.size())
+      throw RegexMatcher::Error("Error: parenthesis mismatch");
+
+    if(left == m_expr[index])
+      lcount++;
+
+    if(right == m_expr[index])
+      rcount++;
+
+    index++;
+  }
+  return index;
+}
+
+inline int 
+RegexPatternListMatcher::extractRepetition(int index)
+{
+  int exprSize = m_expr.size();
+
+  if(index == exprSize)
+    return index;
+    
+  if(('+' == m_expr[index] || '?' == m_expr[index] || '*' == m_expr[index])){
+    return ++index;
+  }
+    
+  if('{' == m_expr[index]){
+    while('}' != m_expr[index]){
+      index++;
+      if(index == exprSize)
+        break;
+    }
+    if(index == exprSize)
+      throw RegexMatcher::Error(std::string("Error: RegexPatternListMatcher.ExtractRepetition(): ")
+                                + "Missing right brace bracket");
+    else
+      return ++index;
+  }
+  else {
+    return index;
+  }
+}
+
+
+} // namespace ndn
+
+#endif // NDN_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
diff --git a/src/util/regex/regex-pseudo-matcher.cpp b/src/util/regex/regex-pseudo-matcher.cpp
deleted file mode 100644
index abebaff..0000000
--- a/src/util/regex/regex-pseudo-matcher.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Yingdi Yu <yingdi@cs.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "regex-pseudo-matcher.hpp"
-
-#include "../logging.hpp"
-
-INIT_LOGGER ("RegexPseudoMatcher");
-
-using namespace std;
-
-namespace ndn
-{
-RegexPseudoMatcher::RegexPseudoMatcher()
-  :RegexMatcher ("", EXPR_PSEUDO)
-{}
-
-void 
-RegexPseudoMatcher::setMatchResult(const string & str)
-{ m_matchResult.push_back(Name::Component((const uint8_t *)str.c_str(), str.size())); }
-    
-void 
-RegexPseudoMatcher::resetMatchResult()
-{ m_matchResult.clear(); }
-
-}//ndn
diff --git a/src/util/regex/regex-pseudo-matcher.hpp b/src/util/regex/regex-pseudo-matcher.hpp
index 9bb1e9f..0aeea57 100644
--- a/src/util/regex/regex-pseudo-matcher.hpp
+++ b/src/util/regex/regex-pseudo-matcher.hpp
@@ -5,24 +5,27 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NDN_REGEX_PSEUDO_MATCHER_HPP
-#define NDN_REGEX_PSEUDO_MATCHER_HPP
+#ifndef NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
+#define NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
 
+#include "../../common.hpp"
 #include "regex-matcher.hpp"
 
-namespace ndn
-{
+namespace ndn {
+
 class RegexPseudoMatcher : public RegexMatcher
 {
 public:
   RegexPseudoMatcher();
 
-  ~RegexPseudoMatcher() 
-  {}
+  virtual ~RegexPseudoMatcher() 
+  {
+  }
 
   virtual void 
   compile() 
-  {}
+  {
+  }
 
   void 
   setMatchResult(const std::string& str);
@@ -31,6 +34,24 @@
   resetMatchResult();
 };
 
-}//ndn
+inline RegexPseudoMatcher::RegexPseudoMatcher()
+  :RegexMatcher ("", EXPR_PSEUDO)
+{
+}
 
-#endif
+inline void 
+RegexPseudoMatcher::setMatchResult(const std::string& str)
+{
+  m_matchResult.push_back(Name::Component((const uint8_t *)str.c_str(), str.size()));
+}
+    
+inline void 
+RegexPseudoMatcher::resetMatchResult()
+{
+  m_matchResult.clear();
+}
+
+
+} // namespace ndn
+
+#endif // NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
diff --git a/src/util/regex/regex-repeat-matcher.cpp b/src/util/regex/regex-repeat-matcher.cpp
deleted file mode 100644
index d121b9e..0000000
--- a/src/util/regex/regex-repeat-matcher.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Yingdi Yu <yingdi@cs.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include <limits>
-#include <stdlib.h>
-
-#include <boost/regex.hpp>
-
-#include "regex-repeat-matcher.hpp"
-#include "regex-backref-matcher.hpp"
-#include "regex-component-set-matcher.hpp"
-
-#include "../logging.hpp"
-
-INIT_LOGGER ("RegexRepeatMatcher");
-
-using namespace std;
-
-namespace ndn
-{
-RegexRepeatMatcher::RegexRepeatMatcher(const string expr, ptr_lib::shared_ptr<RegexBackrefManager> backrefManager, int indicator)
-  : RegexMatcher (expr, EXPR_REPEAT_PATTERN, backrefManager),
-    m_indicator(indicator)
-{
-  // _LOG_TRACE ("Enter RegexRepeatMatcher Constructor");
-  compile();
-  // _LOG_TRACE ("Exit RegexRepeatMatcher Constructor");
-}
-
-void 
-RegexRepeatMatcher::compile()
-{
-  // _LOG_TRACE ("Enter RegexRepeatMatcher::compile");
-    
-  ptr_lib::shared_ptr<RegexMatcher> matcher;
-
-  if('(' == m_expr[0]){
-    matcher = ptr_lib::make_shared<RegexBackrefMatcher>(m_expr.substr(0, m_indicator), m_backrefManager);
-    m_backrefManager->pushRef(matcher);
-    boost::dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
-  }
-  else{
-    matcher = ptr_lib::make_shared<RegexComponentSetMatcher>(m_expr.substr(0, m_indicator), m_backrefManager);
-  }
-  m_matcherList.push_back(matcher);
-      
-  parseRepetition();
-
-  // _LOG_TRACE ("Exit RegexRepeatMatcher::compile");
-
-}
-
-bool 
-RegexRepeatMatcher::parseRepetition()
-{
-  // _LOG_DEBUG ("Enter RegexRepeatMatcher::ParseRepetition()" << m_expr << " indicator: " << m_indicator);
-
-  string errMsg = "Error: RegexRepeatMatcher.ParseRepetition(): ";
-    
-  int exprSize = m_expr.size();
-  int intMax = numeric_limits<int>::max();
-    
-  if(exprSize == m_indicator){
-    m_repeatMin = 1;
-    m_repeatMax = 1;
-
-    return true;
-  }
-  else{
-    if(exprSize == (m_indicator + 1)){
-      if('?' == m_expr[m_indicator]){
-        m_repeatMin = 0;
-        m_repeatMax = 1;
-        return true;
-      }
-      if('+' == m_expr[m_indicator]){
-        m_repeatMin = 1;
-        m_repeatMax = intMax;
-        return true;
-      }
-      if('*' == m_expr[m_indicator]){
-        m_repeatMin = 0;
-        m_repeatMax = intMax;
-        return true;
-      }
-    }
-    else{
-      string repeatStruct = m_expr.substr(m_indicator, exprSize - m_indicator);
-      int rsSize = repeatStruct.size();
-      int min = 0;
-      int max = 0;
-
-      if(boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+,[0-9]+\\}"))){
-        int separator = repeatStruct.find_first_of(',', 0);
-        min = atoi(repeatStruct.substr(1, separator - 1).c_str());
-        max = atoi(repeatStruct.substr(separator + 1, rsSize - separator - 2).c_str());
-      }
-      else if(boost::regex_match(repeatStruct, boost::regex("\\{,[0-9]+\\}"))){
-        int separator = repeatStruct.find_first_of(',', 0);
-        min = 0;
-        max = atoi(repeatStruct.substr(separator + 1, rsSize - separator - 2).c_str());
-      }
-      else if(boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+,\\}"))){
-        int separator = repeatStruct.find_first_of(',', 0);
-        min = atoi(repeatStruct.substr(1, separator).c_str());
-        max = intMax;
-      }
-      else if(boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+\\}"))){
-        min = atoi(repeatStruct.substr(1, rsSize - 1).c_str());
-        max = min;
-      }
-      else
-        throw RegexMatcher::Error(errMsg + "Unrecognized format "+ m_expr);
-        
-      if(min > intMax || max > intMax || min > max)
-        throw RegexMatcher::Error(errMsg + "Wrong number " + m_expr);
-          
-      m_repeatMin = min;
-      m_repeatMax = max;
-        
-      return true;
-    }
-  }
-  return false;
-}
-
-bool
-RegexRepeatMatcher::match(const Name & name, const int & offset, const int & len)
-{
-  // _LOG_TRACE ("Enter RegexRepeatMatcher::match");
-
-  m_matchResult.clear();
-
-  if (0 == m_repeatMin)
-    if (0 == len)
-      return true;
-
-  if (recursiveMatch(0, name, offset, len))
-    {
-      for (int i = offset; i < offset + len; i++)
-        m_matchResult.push_back(name.get(i));
-      return true;
-    }
-  else
-    return false;
-}
-
-bool 
-RegexRepeatMatcher::recursiveMatch(int repeat, const Name & name, const int & offset, const int & len)
-{
-  // _LOG_TRACE ("Enter RegexRepeatMatcher::recursiveMatch");
-
-  // _LOG_DEBUG ("repeat: " << repeat << " offset: " << offset << " len: " << len);
-  // _LOG_DEBUG ("m_repeatMin: " << m_repeatMin << " m_repeatMax: " << m_repeatMax);
-
-  int tried = len;
-  ptr_lib::shared_ptr<RegexMatcher> matcher = m_matcherList[0];
-
-  if (0 < len && repeat >= m_repeatMax)
-    {
-      // _LOG_DEBUG("Match Fail: Reach m_repeatMax && More components");
-      return false;
-    }
-
-  if (0 == len && repeat < m_repeatMin)
-    {
-      // _LOG_DEBUG("Match Fail: No more components && have NOT reached m_repeatMin " << len << ", " << m_repeatMin);
-      return false;
-    }
-
-  if (0 == len && repeat >= m_repeatMin)
-    {
-      // _LOG_DEBUG("Match Succeed: No more components && reach m_repeatMin");
-      return true;
-    }
-    
-  while(tried >= 0)
-    {
-      // _LOG_DEBUG("Attempt tried: " << tried);
-
-      if (matcher->match(name, offset, tried) and recursiveMatch(repeat + 1, name, offset + tried, len - tried))
-        return true;
-      // _LOG_DEBUG("Failed at tried: " << tried);
-      tried --;
-    }
-
-  return false;
-}
-}//ndn
diff --git a/src/util/regex/regex-repeat-matcher.hpp b/src/util/regex/regex-repeat-matcher.hpp
index 9cc0212..fb42042 100644
--- a/src/util/regex/regex-repeat-matcher.hpp
+++ b/src/util/regex/regex-repeat-matcher.hpp
@@ -5,23 +5,26 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NDN_REGEX_REPEAT_MATCHER_HPP
-#define NDN_REGEX_REPEAT_MATCHER_HPP
+#ifndef NDN_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
+#define NDN_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
+
+#include "../../common.hpp"
+
+#include <boost/regex.hpp>
 
 #include "regex-matcher.hpp"
 
-namespace ndn
-{
+namespace ndn {
 
 class RegexRepeatMatcher : public RegexMatcher
 {
 public:
-  RegexRepeatMatcher(const std::string expr, ptr_lib::shared_ptr<RegexBackrefManager> backRefManager, int indicator);
+  RegexRepeatMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backRefManager, int indicator);
     
   virtual ~RegexRepeatMatcher(){}
 
   virtual bool 
-  match(const Name & name, const int & offset, const int & len);
+  match(const Name& name, const int& offset, const int& len);
 
 protected:
   /**
@@ -31,7 +34,6 @@
   virtual void 
   compile();
 
-
 private:
   bool 
   parseRepetition();
@@ -48,6 +50,184 @@
   int m_repeatMax;
 };
 
-}//ndn
+} // namespace ndn
 
-#endif
+#include "regex-backref-matcher.hpp"
+#include "regex-component-set-matcher.hpp"
+
+namespace ndn {
+
+inline
+RegexRepeatMatcher::RegexRepeatMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backrefManager, int indicator)
+  : RegexMatcher (expr, EXPR_REPEAT_PATTERN, backrefManager),
+    m_indicator(indicator)
+{
+  // _LOG_TRACE ("Enter RegexRepeatMatcher Constructor");
+  compile();
+  // _LOG_TRACE ("Exit RegexRepeatMatcher Constructor");
+}
+
+inline void 
+RegexRepeatMatcher::compile()
+{
+  // _LOG_TRACE ("Enter RegexRepeatMatcher::compile");
+    
+  shared_ptr<RegexMatcher> matcher;
+
+  if('(' == m_expr[0]){
+    matcher = make_shared<RegexBackrefMatcher>(m_expr.substr(0, m_indicator), m_backrefManager);
+    m_backrefManager->pushRef(matcher);
+    boost::dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
+  }
+  else{
+    matcher = make_shared<RegexComponentSetMatcher>(m_expr.substr(0, m_indicator), m_backrefManager);
+  }
+  m_matcherList.push_back(matcher);
+      
+  parseRepetition();
+
+  // _LOG_TRACE ("Exit RegexRepeatMatcher::compile");
+
+}
+
+inline bool 
+RegexRepeatMatcher::parseRepetition()
+{
+  // _LOG_DEBUG ("Enter RegexRepeatMatcher::ParseRepetition()" << m_expr << " indicator: " << m_indicator);
+    
+  int exprSize = m_expr.size();
+  int intMax = std::numeric_limits<int>::max();
+    
+  if(exprSize == m_indicator){
+    m_repeatMin = 1;
+    m_repeatMax = 1;
+
+    return true;
+  }
+  else{
+    if(exprSize == (m_indicator + 1)){
+      if('?' == m_expr[m_indicator]){
+        m_repeatMin = 0;
+        m_repeatMax = 1;
+        return true;
+      }
+      if('+' == m_expr[m_indicator]){
+        m_repeatMin = 1;
+        m_repeatMax = intMax;
+        return true;
+      }
+      if('*' == m_expr[m_indicator]){
+        m_repeatMin = 0;
+        m_repeatMax = intMax;
+        return true;
+      }
+    }
+    else{
+      std::string repeatStruct = m_expr.substr(m_indicator, exprSize - m_indicator);
+      int rsSize = repeatStruct.size();
+      int min = 0;
+      int max = 0;
+
+      if(boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+,[0-9]+\\}"))){
+        int separator = repeatStruct.find_first_of(',', 0);
+        min = atoi(repeatStruct.substr(1, separator - 1).c_str());
+        max = atoi(repeatStruct.substr(separator + 1, rsSize - separator - 2).c_str());
+      }
+      else if(boost::regex_match(repeatStruct, boost::regex("\\{,[0-9]+\\}"))){
+        int separator = repeatStruct.find_first_of(',', 0);
+        min = 0;
+        max = atoi(repeatStruct.substr(separator + 1, rsSize - separator - 2).c_str());
+      }
+      else if(boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+,\\}"))){
+        int separator = repeatStruct.find_first_of(',', 0);
+        min = atoi(repeatStruct.substr(1, separator).c_str());
+        max = intMax;
+      }
+      else if(boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+\\}"))){
+        min = atoi(repeatStruct.substr(1, rsSize - 1).c_str());
+        max = min;
+      }
+      else
+        throw RegexMatcher::Error(std::string("Error: RegexRepeatMatcher.ParseRepetition(): ")
+                                  + "Unrecognized format "+ m_expr);
+        
+      if(min > intMax || max > intMax || min > max)
+        throw RegexMatcher::Error(std::string("Error: RegexRepeatMatcher.ParseRepetition(): ")
+                                  + "Wrong number " + m_expr);
+          
+      m_repeatMin = min;
+      m_repeatMax = max;
+        
+      return true;
+    }
+  }
+  return false;
+}
+
+inline bool
+RegexRepeatMatcher::match(const Name & name, const int & offset, const int & len)
+{
+  // _LOG_TRACE ("Enter RegexRepeatMatcher::match");
+
+  m_matchResult.clear();
+
+  if (0 == m_repeatMin)
+    if (0 == len)
+      return true;
+
+  if (recursiveMatch(0, name, offset, len))
+    {
+      for (int i = offset; i < offset + len; i++)
+        m_matchResult.push_back(name.get(i));
+      return true;
+    }
+  else
+    return false;
+}
+
+inline bool 
+RegexRepeatMatcher::recursiveMatch(int repeat, const Name & name, const int & offset, const int & len)
+{
+  // _LOG_TRACE ("Enter RegexRepeatMatcher::recursiveMatch");
+
+  // _LOG_DEBUG ("repeat: " << repeat << " offset: " << offset << " len: " << len);
+  // _LOG_DEBUG ("m_repeatMin: " << m_repeatMin << " m_repeatMax: " << m_repeatMax);
+
+  int tried = len;
+  shared_ptr<RegexMatcher> matcher = m_matcherList[0];
+
+  if (0 < len && repeat >= m_repeatMax)
+    {
+      // _LOG_DEBUG("Match Fail: Reach m_repeatMax && More components");
+      return false;
+    }
+
+  if (0 == len && repeat < m_repeatMin)
+    {
+      // _LOG_DEBUG("Match Fail: No more components && have NOT reached m_repeatMin " << len << ", " << m_repeatMin);
+      return false;
+    }
+
+  if (0 == len && repeat >= m_repeatMin)
+    {
+      // _LOG_DEBUG("Match Succeed: No more components && reach m_repeatMin");
+      return true;
+    }
+    
+  while(tried >= 0)
+    {
+      // _LOG_DEBUG("Attempt tried: " << tried);
+
+      if (matcher->match(name, offset, tried) and recursiveMatch(repeat + 1, name, offset + tried, len - tried))
+        return true;
+      // _LOG_DEBUG("Failed at tried: " << tried);
+      tried --;
+    }
+
+  return false;
+}
+
+
+} // namespace ndn
+
+#endif // NDN_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
diff --git a/src/util/regex/regex-top-matcher.cpp b/src/util/regex/regex-top-matcher.cpp
index 3e7d4ce..2c93f17 100644
--- a/src/util/regex/regex-top-matcher.cpp
+++ b/src/util/regex/regex-top-matcher.cpp
@@ -5,28 +5,26 @@
  * See COPYING for copyright and distribution information.
  */
 
-#include <stdlib.h>
-
 #include "regex-top-matcher.hpp"
 
-#include "../logging.hpp"
+#include "regex-backref-manager.hpp"
+#include "regex-pattern-list-matcher.hpp"
 
-INIT_LOGGER ("RegexTopMatcher");
+// #include "../logging.hpp"
 
-using namespace std;
+// INIT_LOGGER ("RegexTopMatcher");
 
-namespace ndn
-{
+namespace ndn {
 
-RegexTopMatcher::RegexTopMatcher(const string & expr, const string & expand)
+RegexTopMatcher::RegexTopMatcher(const std::string& expr, const std::string& expand)
   : RegexMatcher(expr, EXPR_TOP),
     m_expand(expand),
     m_secondaryUsed(false)
 {
   // _LOG_TRACE ("Enter RegexTopMatcher Constructor");
 
-  m_primaryBackRefManager = ptr_lib::make_shared<RegexBackrefManager>();
-  m_secondaryBackRefManager = ptr_lib::make_shared<RegexBackrefManager>();
+  m_primaryBackRefManager = make_shared<RegexBackrefManager>();
+  m_secondaryBackRefManager = make_shared<RegexBackrefManager>();
   compile();
 
   // _LOG_TRACE ("Exit RegexTopMatcher Constructor");
@@ -42,9 +40,9 @@
 {
   // _LOG_TRACE ("Enter RegexTopMatcher::compile");
 
-  string errMsg = "Error: RegexTopMatcher.Compile(): ";
+  std::string errMsg = "Error: RegexTopMatcher.Compile(): ";
 
-  string expr = m_expr;
+  std::string expr = m_expr;
 
   if('$' != expr[expr.size() - 1])
     expr = expr + "<.*>*";
@@ -52,14 +50,15 @@
     expr = expr.substr(0, expr.size()-1);
 
   if('^' != expr[0])
-    m_secondaryMatcher = ptr_lib::make_shared<RegexPatternListMatcher>("<.*>*" + expr, m_secondaryBackRefManager);
+    m_secondaryMatcher = make_shared<RegexPatternListMatcher>(boost::cref("<.*>*" + expr),
+                                                              boost::cref(m_secondaryBackRefManager));
   else
     expr = expr.substr(1, expr.size()-1);
 
   // _LOG_DEBUG ("reconstructed expr: " << expr);
-                                                        
-                                                        
-  m_primaryMatcher = ptr_lib::make_shared<RegexPatternListMatcher>(expr, m_primaryBackRefManager);
+
+  m_primaryMatcher = make_shared<RegexPatternListMatcher>(boost::cref(expr),
+                                                          boost::cref(m_primaryBackRefManager));
 
   // _LOG_TRACE ("Exit RegexTopMatcher::compile");
 }
@@ -97,17 +96,17 @@
 }
 
 Name 
-RegexTopMatcher::expand (const string & expandStr)
+RegexTopMatcher::expand (const std::string& expandStr)
 {
   // _LOG_TRACE("Enter RegexTopMatcher::expand");
 
   Name result;
     
-  ptr_lib::shared_ptr<RegexBackrefManager> backRefManager = (m_secondaryUsed ? m_secondaryBackRefManager : m_primaryBackRefManager);
+  shared_ptr<RegexBackrefManager> backRefManager = (m_secondaryUsed ? m_secondaryBackRefManager : m_primaryBackRefManager);
     
   int backRefNum = backRefManager->size();
 
-  string expand;
+  std::string expand;
     
   if(expandStr != "")
     expand = expandStr;
@@ -117,7 +116,7 @@
   int offset = 0;
   while(offset < expand.size())
     {
-      string item = getItemFromExpand(expand, offset);
+      std::string item = getItemFromExpand(expand, offset);
       if(item[0] == '<')
         {
           result.append(item.substr(1, item.size() - 2));
@@ -128,15 +127,15 @@
           int index = atoi(item.substr(1, item.size() - 1).c_str());
 
           if(0 == index){
-            vector<Name::Component>::iterator it = m_matchResult.begin();
-            vector<Name::Component>::iterator end = m_matchResult.end();
+            std::vector<name::Component>::iterator it = m_matchResult.begin();
+            std::vector<name::Component>::iterator end = m_matchResult.end();
             for(; it != end; it++)
               result.append (*it);
           }
           else if(index <= backRefNum)
             {
-              vector<Name::Component>::const_iterator it = backRefManager->getBackRef (index - 1)->getMatchResult ().begin();
-              vector<Name::Component>::const_iterator end = backRefManager->getBackRef (index - 1)->getMatchResult ().end();
+              std::vector<name::Component>::const_iterator it = backRefManager->getBackRef (index - 1)->getMatchResult ().begin();
+              std::vector<name::Component>::const_iterator end = backRefManager->getBackRef (index - 1)->getMatchResult ().end();
               for(; it != end; it++)
                 result.append (*it);
             }
@@ -147,8 +146,8 @@
   return result;
 }
 
-string
-RegexTopMatcher::getItemFromExpand(const string & expand, int & offset)
+std::string
+RegexTopMatcher::getItemFromExpand(const std::string& expand, int & offset)
 {
   // _LOG_TRACE("Enter RegexTopMatcher::getItemFromExpand ");
   int begin = offset;
@@ -193,11 +192,11 @@
     throw RegexMatcher::Error("wrong format of expand string!");
 }
 
-ptr_lib::shared_ptr<RegexTopMatcher>
+shared_ptr<RegexTopMatcher>
 RegexTopMatcher::fromName(const Name& name, bool hasAnchor)
 {
   Name::const_iterator it = name.begin();
-  string regexStr("^");
+  std::string regexStr("^");
     
   for(; it != name.end(); it++)
     {
@@ -209,13 +208,13 @@
   if(hasAnchor)
     regexStr.append("$");
 
-  return ptr_lib::make_shared<RegexTopMatcher>(regexStr);
+  return make_shared<RegexTopMatcher>(boost::cref(regexStr));
 }
 
-string
-RegexTopMatcher::convertSpecialChar(const string& str)
+std::string
+RegexTopMatcher::convertSpecialChar(const std::string& str)
 {
-  string newStr;
+  std::string newStr;
   for(int i = 0; i < str.size(); i++)
     {
       char c = str[i];
diff --git a/src/util/regex/regex-top-matcher.hpp b/src/util/regex/regex-top-matcher.hpp
index 764726f..fc4a0df 100644
--- a/src/util/regex/regex-top-matcher.hpp
+++ b/src/util/regex/regex-top-matcher.hpp
@@ -5,33 +5,36 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NDN_REGEX_TOP_MATCHER_HPP
-#define NDN_REGEX_TOP_MATCHER_HPP
+#ifndef NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
+#define NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
 
-#include <string>
+#include "../../common.hpp"
 
 #include "regex-matcher.hpp"
-#include "regex-pattern-list-matcher.hpp"
 
-namespace ndn
-{
+namespace ndn {
+
+class RegexPatternListMatcher;
+class RegexBackrefManager;
+
 class RegexTopMatcher: public RegexMatcher
 {
 public:
-  RegexTopMatcher(const std::string & expr, const std::string & expand = "");
+  RegexTopMatcher(const std::string & expr, const std::string& expand = "");
     
-  virtual ~RegexTopMatcher();
+  virtual
+  ~RegexTopMatcher();
 
   bool 
-  match(const Name & name);
+  match(const Name& name);
 
   virtual bool
-  match (const Name & name, const int & offset, const int & len);
+  match (const Name& name, const int& offset, const int& len);
 
   virtual Name 
-  expand (const std::string & expand = "");
+  expand (const std::string& expand = "");
 
-  static ptr_lib::shared_ptr<RegexTopMatcher>
+  static shared_ptr<RegexTopMatcher>
   fromName(const Name& name, bool hasAnchor=false);
 
 protected:
@@ -40,21 +43,20 @@
 
 private:
   std::string
-  getItemFromExpand(const std::string & expand, int & offset);
+  getItemFromExpand(const std::string& expand, int & offset);
 
   static std::string
   convertSpecialChar(const std::string& str);
 
 private:
   const std::string m_expand;
-  ptr_lib::shared_ptr<RegexPatternListMatcher> m_primaryMatcher;
-  ptr_lib::shared_ptr<RegexPatternListMatcher> m_secondaryMatcher;
-  ptr_lib::shared_ptr<RegexBackrefManager> m_primaryBackRefManager;
-  ptr_lib::shared_ptr<RegexBackrefManager> m_secondaryBackRefManager;
+  shared_ptr<RegexPatternListMatcher> m_primaryMatcher;
+  shared_ptr<RegexPatternListMatcher> m_secondaryMatcher;
+  shared_ptr<RegexBackrefManager> m_primaryBackRefManager;
+  shared_ptr<RegexBackrefManager> m_secondaryBackRefManager;
   bool m_secondaryUsed;
 };
 
-}
+} // namespace ndn
 
-#endif
-
+#endif // NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
