diff --git a/src/utility/logger.cpp b/src/utility/logger.cpp
new file mode 100644
index 0000000..3d9a804
--- /dev/null
+++ b/src/utility/logger.cpp
@@ -0,0 +1,59 @@
+#include "logger.hpp"
+
+namespace nlsr {
+
+string
+Logger::getEpochTime()
+{
+  std::stringstream ss;
+  boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970, 1, 1));
+  boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
+  boost::posix_time::time_duration diff = now - time_t_epoch;
+  ss << diff.total_seconds() << "." << boost::format("%06i") %
+     (diff.total_microseconds()
+      % 1000000);
+  return ss.str();
+}
+
+string
+Logger::getUserHomeDirectory()
+{
+  string homeDirPath(getpwuid(getuid())->pw_dir);
+  if (homeDirPath.empty())
+  {
+    homeDirPath = getenv("HOME");
+  }
+  return homeDirPath;
+}
+
+void
+Logger::initialize(std::string dirPath)
+{
+  string logDirPath(dirPath);
+  if (dirPath.empty())
+  {
+    logDirPath = getUserHomeDirectory() + "/nlsrLog";
+  }
+  cout << "Log Dir Path: " << logDirPath << endl;
+  typedef sinks::synchronous_sink<sinks::text_file_backend> file_sink;
+  shared_ptr<file_sink> sink(new file_sink(
+                               keywords::file_name = logDirPath
+                                                     + "/NLSR%Y%m%d%H%M%S_%3N.log",
+                               keywords::rotation_size = 16 * 1024 * 1024,
+                               keywords::time_based_rotation = sinks::file::rotation_at_time_point(12, 0, 0),
+                               keywords::auto_flush = true
+                             ));
+  sink->locked_backend()->set_file_collector(sinks::file::make_collector(
+                                               keywords::target = logDirPath,
+                                               //keywords::max_size =  512 * 1024 * 1024,
+                                               keywords::min_free_space = 64 * 1024 * 1024
+                                             ));
+  sink->set_formatter(
+    expr::format("%1% %2%")
+    % getEpochTime()
+    % expr::smessage
+  );
+  logging::core::get()->add_sink(sink);
+}
+
+}//namespace nlsr
diff --git a/src/utility/logger.hpp b/src/utility/logger.hpp
new file mode 100644
index 0000000..97b8df4
--- /dev/null
+++ b/src/utility/logger.hpp
@@ -0,0 +1,64 @@
+#ifndef NLSR_LOGGER_HPP
+#define NLSR_LOGGER_HPP
+
+#define BOOST_LOG_DYN_LINK 1
+#include "boost-log.hpp"
+
+#include <stdexcept>
+#include <string>
+#include <iostream>
+#include <sstream>
+#include <pwd.h>
+#include <cstdlib>
+#include <string>
+#include <unistd.h>
+#include <boost/format.hpp>
+#include <boost/smart_ptr/shared_ptr.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/local_time/local_time.hpp>
+
+
+
+
+namespace nlsr {
+
+namespace logging = boost::log;
+namespace attrs = boost::log::attributes;
+namespace src = boost::log::sources;
+namespace sinks = boost::log::sinks;
+namespace expr = boost::log::expressions;
+namespace keywords = boost::log::keywords;
+
+using boost::shared_ptr;
+using namespace std;
+
+
+class Logger
+{
+public:
+  Logger()
+  {
+  }
+
+  void
+  initialize(std::string dirPath);
+
+  src::logger&
+  getLogger()
+  {
+    return m_Logger;
+  }
+
+private:
+  string
+  getEpochTime();
+
+  string
+  getUserHomeDirectory();
+
+private:
+  src::logger m_Logger;
+};
+
+}//namespace nlsr
+#endif //NLSR_LOGGER_HPP
diff --git a/src/utility/nlsr_logger.cpp b/src/utility/nlsr_logger.cpp
deleted file mode 100644
index f214c6a..0000000
--- a/src/utility/nlsr_logger.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "nlsr_logger.hpp"
-
-namespace nlsr
-{
-
-  string
-  NlsrLogger::getEpochTime()
-  {
-    std::stringstream ss;
-    boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970,1,1));
-    boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
-    boost::posix_time::time_duration diff = now - time_t_epoch;
-    ss<<diff.total_seconds()<<"."<<boost::format("%06i")%(diff.total_microseconds()
-        %1000000);
-    return ss.str();
-  }
-
-  string
-  NlsrLogger::getUserHomeDirectory()
-  {
-    string homeDirPath(getpwuid(getuid())->pw_dir);
-    if( homeDirPath.empty() )
-    {
-      homeDirPath = getenv("HOME");
-    }
-    return homeDirPath;
-  }
-
-  void
-  NlsrLogger::initNlsrLogger(std::string dirPath)
-  {
-    string logDirPath(dirPath);
-    if( dirPath.empty() )
-    {
-      logDirPath=getUserHomeDirectory()+"/nlsrLog";
-    }
-    cout<<"Log Dir Path: "<< logDirPath<<endl;
-    typedef sinks::synchronous_sink< sinks::text_file_backend > file_sink;
-    shared_ptr< file_sink > sink(new file_sink(
-                                   keywords::file_name = logDirPath
-                                       +"/NLSR%Y%m%d%H%M%S_%3N.log",
-                                   keywords::rotation_size = 16 * 1024 * 1024,
-                                   keywords::time_based_rotation = sinks::file::rotation_at_time_point(12, 0, 0),
-                                   keywords::auto_flush = true
-                                 ));
-    sink->locked_backend()->set_file_collector(sinks::file::make_collector(
-          keywords::target = logDirPath,
-          //keywords::max_size =  512 * 1024 * 1024,
-          keywords::min_free_space = 64 * 1024 * 1024
-        ));
-    sink->set_formatter(
-      expr::format("%1% %2%")
-      % getEpochTime()
-      % expr::smessage
-    );
-    logging::core::get()->add_sink(sink);
-  }
-
-}//namespace nlsr
diff --git a/src/utility/nlsr_logger.hpp b/src/utility/nlsr_logger.hpp
deleted file mode 100644
index ca6be3e..0000000
--- a/src/utility/nlsr_logger.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef NLSR_LOGGER_HPP
-#define NLSR_LOGGER_HPP
-
-#define BOOST_LOG_DYN_LINK 1
-#include "boost-log.hpp"
-
-#include <stdexcept>
-#include <string>
-#include <iostream>
-#include <sstream>
-#include <pwd.h>
-#include <cstdlib>
-#include <string>
-#include <unistd.h>
-#include <boost/format.hpp>
-#include <boost/smart_ptr/shared_ptr.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/date_time/local_time/local_time.hpp>
-
-
-
-
-namespace nlsr
-{
-
-  namespace logging = boost::log;
-  namespace attrs = boost::log::attributes;
-  namespace src = boost::log::sources;
-  namespace sinks = boost::log::sinks;
-  namespace expr = boost::log::expressions;
-  namespace keywords = boost::log::keywords;
-
-  using boost::shared_ptr;
-  using namespace std;
-
-
-  class NlsrLogger
-  {
-  public:
-    NlsrLogger()
-    {
-    }
-
-    void initNlsrLogger(std::string dirPath);
-
-    src::logger& getLogger()
-    {
-      return mLogger;
-    }
-
-  private:
-    string getEpochTime();
-    string getUserHomeDirectory();
-
-  private:
-    src::logger mLogger;
-  };
-
-}//namespace nlsr
-#endif
diff --git a/src/utility/nlsr_tokenizer.cpp b/src/utility/nlsr_tokenizer.cpp
deleted file mode 100644
index a1ed2bd..0000000
--- a/src/utility/nlsr_tokenizer.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-#include <iostream>
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-#include <string>
-#include <algorithm>
-
-#include "nlsr_tokenizer.hpp"
-
-namespace nlsr
-{
-
-  using namespace std;
-  using namespace boost;
-
-  void
-  nlsrTokenizer::makeToken()
-  {
-    char_separator<char> sep(m_seps.c_str());
-    tokenizer< char_separator<char> >tokens(m_originalString, sep);
-    tokenizer< char_separator<char> >::iterator tok_iter = tokens.begin();
-    for ( ; tok_iter != tokens.end(); ++tok_iter)
-    {
-      string oneToken(*tok_iter);
-      trim(oneToken);
-      if(!oneToken.empty())
-      {
-        insertToken(oneToken);
-      }
-    }
-    m_firstToken=m_vTokenList[0];
-    makeRestOfTheLine();
-  }
-
-  void
-  nlsrTokenizer::insertToken(const string& token)
-  {
-    m_tokenList.push_back(token);
-    m_vTokenList.push_back(token);
-  }
-
-  int
-  nlsrTokenizer::getTokenPosition(string& token)
-  {
-    int pos=-1;
-    int i=0;
-    for(std::list<string>::iterator it=m_tokenList.begin();
-        it!=m_tokenList.end(); it++)
-    {
-      if( (*it) == token )
-      {
-        break;
-      }
-      i++;
-    }
-    if( i < m_tokenList.size() )
-    {
-      pos=i;
-    }
-    return pos;
-  }
-
-  string
-  nlsrTokenizer::getTokenString(int from , int to)
-  {
-    string returnString="";
-    if((from>=0 && to<m_tokenList.size()) &&
-        (to>=from && to <m_tokenList.size()))
-    {
-      for(int i=from; i<=to; i++)
-      {
-        returnString+=m_seps;
-        returnString+=m_vTokenList[i];
-      }
-    }
-    trim(returnString);
-    return returnString;
-  }
-
-  string
-  nlsrTokenizer::getTokenString(int from)
-  {
-    return getTokenString(from,m_tokenList.size()-1);
-  }
-
-  static bool
-  tokenCompare(string& s1, string& s2)
-  {
-    return s1==s2;
-  }
-
-  void
-  nlsrTokenizer::makeRestOfTheLine()
-  {
-    m_restOfTheLine=getTokenString(1);
-  }
-
-  bool
-  nlsrTokenizer::doesTokenExist(string token)
-  {
-    std::list<string >::iterator it = std::find_if( m_tokenList.begin(),
-                                      m_tokenList.end(),
-                                      bind(&tokenCompare, _1 , token));
-    if( it != m_tokenList.end() )
-    {
-      return true;
-    }
-    return false;
-  }
-
-}//namespace nlsr
diff --git a/src/utility/nlsr_tokenizer.hpp b/src/utility/nlsr_tokenizer.hpp
deleted file mode 100644
index 02d6eea..0000000
--- a/src/utility/nlsr_tokenizer.hpp
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef NLSR_TOKENIZER_HPP
-#define NLSR_TOKENIZER_HPP
-
-#include <iostream>
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-#include <string>
-#include <list>
-#include <vector>
-#include <ndn-cpp-dev/face.hpp>
-
-namespace nlsr
-{
-
-  using namespace std;
-  using namespace boost;
-
-  class nlsrTokenizer
-  {
-  public:
-    nlsrTokenizer(const string& inputString)
-      : m_firstToken()
-      , m_restOfTheLine()
-      , m_currentPosition(0)
-    {
-      m_seps = " ";
-      m_originalString = inputString;
-      makeToken();
-    }
-
-    nlsrTokenizer(const string& inputString, const string& separator)
-      : m_firstToken()
-      , m_restOfTheLine()
-      , m_currentPosition(0)
-    {
-      m_seps = separator;
-      m_originalString = inputString;
-      makeToken();
-    }
-
-    string getFirstToken()
-    {
-      return m_firstToken;
-    }
-
-    string getRestOfLine()
-    {
-      return m_restOfTheLine;
-    }
-
-    void resetCurrentPosition(uint32_t cp=0)
-    {
-      if( cp >=0 && cp <= m_vTokenList.size() )
-      {
-        m_currentPosition=cp;
-      }
-    }
-
-    string getNextToken()
-    {
-      if(m_currentPosition >= 0 && m_currentPosition <= (m_vTokenList.size()-1))
-      {
-        return m_vTokenList[m_currentPosition++];
-      }
-      return "";
-    }
-
-    uint32_t getTokenNumber()
-    {
-      return m_tokenList.size();
-    }
-
-    string getToken(int position)
-    {
-      if( position >=0 && position <m_vTokenList.size() )
-      {
-        return m_vTokenList[position];
-      }
-      return "";
-    }
-
-    int getTokenPosition(string& token);
-    string getTokenString(int from , int to);
-    string getTokenString(int from);
-    bool doesTokenExist(string token);
-
-
-  private:
-
-    void makeToken();
-    void insertToken(const string& token);
-    void makeRestOfTheLine();
-
-    string m_seps;
-    string m_originalString;
-    string m_firstToken;
-    string m_restOfTheLine;
-    std::list<string> m_tokenList;
-    std::vector<string> m_vTokenList;
-    uint32_t m_currentPosition;
-  };
-
-}//namespace nlsr
-#endif
diff --git a/src/utility/tokenizer.cpp b/src/utility/tokenizer.cpp
new file mode 100644
index 0000000..e326c2a
--- /dev/null
+++ b/src/utility/tokenizer.cpp
@@ -0,0 +1,109 @@
+#include <iostream>
+#include <boost/tokenizer.hpp>
+#include <boost/algorithm/string.hpp>
+#include <string>
+#include <algorithm>
+
+#include "tokenizer.hpp"
+
+namespace nlsr {
+
+using namespace std;
+using namespace boost;
+
+void
+Tokenizer::makeToken()
+{
+  char_separator<char> sep(m_seps.c_str());
+  tokenizer<char_separator<char> >tokens(m_originalString, sep);
+  tokenizer<char_separator<char> >::iterator tok_iter = tokens.begin();
+  for (; tok_iter != tokens.end(); ++tok_iter)
+  {
+    string oneToken(*tok_iter);
+    trim(oneToken);
+    if (!oneToken.empty())
+    {
+      insertToken(oneToken);
+    }
+  }
+  m_firstToken = m_vTokenList[0];
+  makeRestOfTheLine();
+}
+
+void
+Tokenizer::insertToken(const string& token)
+{
+  m_tokenList.push_back(token);
+  m_vTokenList.push_back(token);
+}
+
+uint32_t
+Tokenizer::getTokenPosition(string& token)
+{
+  int pos = -1;
+  int i = 0;
+  for (std::list<string>::iterator it = m_tokenList.begin();
+       it != m_tokenList.end(); it++)
+  {
+    if ((*it) == token)
+    {
+      break;
+    }
+    i++;
+  }
+  if (i < m_tokenList.size())
+  {
+    pos = i;
+  }
+  return pos;
+}
+
+string
+Tokenizer::getTokenString(uint32_t from , uint32_t to)
+{
+  string returnString = "";
+  if ((to < m_tokenList.size()) &&
+      (to >= from && to < m_tokenList.size()))
+  {
+    for (int i = from; i <= to; i++)
+    {
+      returnString += m_seps;
+      returnString += m_vTokenList[i];
+    }
+  }
+  trim(returnString);
+  return returnString;
+}
+
+string
+Tokenizer::getTokenString(uint32_t from)
+{
+  return getTokenString(from, m_tokenList.size() - 1);
+}
+
+static bool
+tokenCompare(string& s1, string& s2)
+{
+  return s1 == s2;
+}
+
+void
+Tokenizer::makeRestOfTheLine()
+{
+  m_restOfTheLine = getTokenString(1);
+}
+
+bool
+Tokenizer::doesTokenExist(string token)
+{
+  std::list<string>::iterator it = std::find_if(m_tokenList.begin(),
+                                                m_tokenList.end(),
+                                                bind(&tokenCompare, _1 , token));
+  if (it != m_tokenList.end())
+  {
+    return true;
+  }
+  return false;
+}
+
+}//namespace nlsr
diff --git a/src/utility/tokenizer.hpp b/src/utility/tokenizer.hpp
new file mode 100644
index 0000000..dd6254d
--- /dev/null
+++ b/src/utility/tokenizer.hpp
@@ -0,0 +1,118 @@
+#ifndef NLSR_TOKENIZER_HPP
+#define NLSR_TOKENIZER_HPP
+
+#include <iostream>
+#include <boost/tokenizer.hpp>
+#include <boost/algorithm/string.hpp>
+#include <string>
+#include <list>
+#include <vector>
+#include <ndn-cpp-dev/face.hpp>
+
+namespace nlsr {
+
+class Tokenizer
+{
+public:
+  Tokenizer(const std::string& inputString)
+    : m_firstToken()
+    , m_restOfTheLine()
+    , m_currentPosition(0)
+  {
+    m_seps = " ";
+    m_originalString = inputString;
+    makeToken();
+  }
+
+  Tokenizer(const std::string& inputString, const std::string& separator)
+    : m_firstToken()
+    , m_restOfTheLine()
+    , m_currentPosition(0)
+  {
+    m_seps = separator;
+    m_originalString = inputString;
+    makeToken();
+  }
+
+  std::string
+  getFirstToken()
+  {
+    return m_firstToken;
+  }
+
+  std::string
+  getRestOfLine()
+  {
+    return m_restOfTheLine;
+  }
+
+  void
+  resetCurrentPosition(uint32_t cp = 0)
+  {
+    if (cp <= m_vTokenList.size())
+    {
+      m_currentPosition = cp;
+    }
+  }
+
+  std::string
+  getNextToken()
+  {
+    if (m_currentPosition <= (m_vTokenList.size() - 1))
+    {
+      return m_vTokenList[m_currentPosition++];
+    }
+    return "";
+  }
+
+  uint32_t
+  getTokenNumber()
+  {
+    return m_tokenList.size();
+  }
+
+  std::string
+  getToken(unsigned int position)
+  {
+    if (position < m_vTokenList.size())
+    {
+      return m_vTokenList[position];
+    }
+    return "";
+  }
+
+  uint32_t
+  getTokenPosition(std::string& token);
+
+  std::string
+  getTokenString(uint32_t from , uint32_t to);
+
+  std::string
+  getTokenString(uint32_t from);
+
+  bool
+  doesTokenExist(std::string token);
+
+
+private:
+
+  void
+  makeToken();
+
+  void
+  insertToken(const std::string& token);
+
+  void
+  makeRestOfTheLine();
+
+  std::string m_seps;
+  std::string m_originalString;
+  std::string m_firstToken;
+  std::string m_restOfTheLine;
+  std::list<std::string> m_tokenList;
+  std::vector<std::string> m_vTokenList;
+  uint32_t m_currentPosition;
+};
+
+}//namespace nlsr
+#endif //NLSR_TOKENIZER_HPP
