diff --git a/src/utility/nlsr_logger.cpp b/src/utility/nlsr_logger.cpp
index 804ef98..82b6e75 100644
--- a/src/utility/nlsr_logger.cpp
+++ b/src/utility/nlsr_logger.cpp
@@ -3,57 +3,57 @@
 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::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
+  NlsrLogger::getUserHomeDirectory()
+  {
+    string homeDirPath(getpwuid(getuid())->pw_dir);
+    if( homeDirPath.empty() )
     {
-        string homeDirPath(getpwuid(getuid())->pw_dir);
-        if( homeDirPath.empty() )
-        {
-            homeDirPath = getenv("HOME");
-        }
-        return homeDirPath;
+      homeDirPath = getenv("HOME");
     }
+    return homeDirPath;
+  }
 
-    void
-    NlsrLogger::initNlsrLogger(std::string dirPath)
+  void
+  NlsrLogger::initNlsrLogger(std::string dirPath)
+  {
+    string logDirPath(dirPath);
+    if( dirPath.empty() )
     {
-        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 = 128 * 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 = 16 * 1024 * 1024 * 1024,
-                    keywords::min_free_space = 128 * 1024 * 1024
-                ));
-        sink->set_formatter(
-            expr::format("%1%: %2%")
-            % getEpochTime()
-            % expr::smessage
-        );
-        logging::core::get()->add_sink(sink);
+      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
index 222ac52..129fe30 100644
--- a/src/utility/nlsr_logger.hpp
+++ b/src/utility/nlsr_logger.hpp
@@ -25,38 +25,38 @@
 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;
+  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;
+  using boost::shared_ptr;
+  using namespace std;
 
 
-    class NlsrLogger
+  class NlsrLogger
+  {
+  public:
+    NlsrLogger()
     {
-    public:
-        NlsrLogger()
-        {
-        }
+    }
 
-        void initNlsrLogger(std::string dirPath);
+    void initNlsrLogger(std::string dirPath);
 
-        src::logger& getLogger()
-        {
-            return mLogger;
-        }
+    src::logger& getLogger()
+    {
+      return mLogger;
+    }
 
-    private:
-        string getEpochTime();
-        string getUserHomeDirectory();
+  private:
+    string getEpochTime();
+    string getUserHomeDirectory();
 
-    private:
-        src::logger mLogger;
-    };
+  private:
+    src::logger mLogger;
+  };
 
 }//namespace nlsr
 #endif
diff --git a/src/utility/nlsr_tokenizer.cpp b/src/utility/nlsr_tokenizer.cpp
index 809e395..35d6625 100644
--- a/src/utility/nlsr_tokenizer.cpp
+++ b/src/utility/nlsr_tokenizer.cpp
@@ -9,102 +9,102 @@
 namespace nlsr
 {
 
-    using namespace std;
-    using namespace boost;
+  using namespace std;
+  using namespace boost;
 
-    void
-    nlsrTokenizer::makeToken()
+  void
+  nlsrTokenizer::makeToken()
+  {
+    char_separator<char> sep(seps.c_str());
+    tokenizer< char_separator<char> >tokens(originalString, sep);
+    tokenizer< char_separator<char> >::iterator tok_iter = tokens.begin();
+    for ( ; tok_iter != tokens.end(); ++tok_iter)
     {
-        char_separator<char> sep(seps.c_str());
-        tokenizer< char_separator<char> >tokens(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);
-            }
-        }
-        firstToken=vTokenList[0];
-        makeRestOfTheLine();
+      string oneToken(*tok_iter);
+      trim(oneToken);
+      if(!oneToken.empty())
+      {
+        insertToken(oneToken);
+      }
     }
+    firstToken=vTokenList[0];
+    makeRestOfTheLine();
+  }
 
-    void
-    nlsrTokenizer::insertToken(const string& token)
-    {
-        tokenList.push_back(token);
-        vTokenList.push_back(token);
-    }
+  void
+  nlsrTokenizer::insertToken(const string& token)
+  {
+    tokenList.push_back(token);
+    vTokenList.push_back(token);
+  }
 
-    int
-    nlsrTokenizer::getTokenPosition(string& token)
+  int
+  nlsrTokenizer::getTokenPosition(string& token)
+  {
+    int pos=-1;
+    int i=0;
+    for(std::list<string>::iterator it=tokenList.begin();
+        it!=tokenList.end(); it++)
     {
-        int pos=-1;
-        int i=0;
-        for(std::list<string>::iterator it=tokenList.begin();
-                it!=tokenList.end(); it++)
-        {
-            if( (*it) == token )
-            {
-                break;
-            }
-            i++;
-        }
-        if( i < tokenList.size() )
-        {
-            pos=i;
-        }
-        return pos;
+      if( (*it) == token )
+      {
+        break;
+      }
+      i++;
     }
+    if( i < tokenList.size() )
+    {
+      pos=i;
+    }
+    return pos;
+  }
 
-    string
-    nlsrTokenizer::getTokenString(int from , int to)
+  string
+  nlsrTokenizer::getTokenString(int from , int to)
+  {
+    string returnString="";
+    if((from>=0 && to<tokenList.size()) &&
+        (to>=from && to <tokenList.size()))
     {
-        string returnString="";
-        if((from>=0 && to<tokenList.size()) &&
-                (to>=from && to <tokenList.size()))
-        {
-            for(int i=from; i<=to; i++)
-            {
-                returnString+=seps;
-                returnString+=vTokenList[i];
-            }
-        }
-        trim(returnString);
-        return returnString;
+      for(int i=from; i<=to; i++)
+      {
+        returnString+=seps;
+        returnString+=vTokenList[i];
+      }
     }
+    trim(returnString);
+    return returnString;
+  }
 
-    string
-    nlsrTokenizer::getTokenString(int from)
-    {
-        return getTokenString(from,tokenList.size()-1);
-    }
+  string
+  nlsrTokenizer::getTokenString(int from)
+  {
+    return getTokenString(from,tokenList.size()-1);
+  }
 
-    static bool
-    tokenCompare(string& s1, string& s2)
-    {
-        return s1==s2;
-    }
+  static bool
+  tokenCompare(string& s1, string& s2)
+  {
+    return s1==s2;
+  }
 
-    void
-    nlsrTokenizer::makeRestOfTheLine()
-    {
-        restOfTheLine=getTokenString(1);
-    }
+  void
+  nlsrTokenizer::makeRestOfTheLine()
+  {
+    restOfTheLine=getTokenString(1);
+  }
 
-    bool
-    nlsrTokenizer::doesTokenExist(string token)
+  bool
+  nlsrTokenizer::doesTokenExist(string token)
+  {
+    std::list<string >::iterator it = std::find_if( tokenList.begin(),
+                                      tokenList.end(),
+                                      bind(&tokenCompare, _1 , token));
+    if( it != tokenList.end() )
     {
-        std::list<string >::iterator it = std::find_if( tokenList.begin(),
-                                          tokenList.end(),
-                                          bind(&tokenCompare, _1 , token));
-        if( it != tokenList.end() )
-        {
-            return true;
-        }
-        return false;
+      return true;
     }
+    return false;
+  }
 
 }//namespace nlsr
diff --git a/src/utility/nlsr_tokenizer.hpp b/src/utility/nlsr_tokenizer.hpp
index 6cd97e0..4b84d8b 100644
--- a/src/utility/nlsr_tokenizer.hpp
+++ b/src/utility/nlsr_tokenizer.hpp
@@ -12,93 +12,93 @@
 namespace nlsr
 {
 
-    using namespace std;
-    using namespace boost;
+  using namespace std;
+  using namespace boost;
 
-    class nlsrTokenizer
+  class nlsrTokenizer
+  {
+  public:
+    nlsrTokenizer(const string& inputString)
+      : firstToken()
+      , restOfTheLine()
+      , currentPosition(0)
     {
-    public:
-        nlsrTokenizer(const string& inputString)
-            : firstToken()
-            , restOfTheLine()
-            , currentPosition(0)
-        {
-            seps = " ";
-            originalString = inputString;
-            makeToken();
-        }
+      seps = " ";
+      originalString = inputString;
+      makeToken();
+    }
 
-        nlsrTokenizer(const string& inputString, const string& separator)
-            : firstToken()
-            , restOfTheLine()
-            , currentPosition(0)
-        {
-            seps = separator;
-            originalString = inputString;
-            makeToken();
-        }
+    nlsrTokenizer(const string& inputString, const string& separator)
+      : firstToken()
+      , restOfTheLine()
+      , currentPosition(0)
+    {
+      seps = separator;
+      originalString = inputString;
+      makeToken();
+    }
 
-        string getFirstToken()
-        {
-            return firstToken;
-        }
+    string getFirstToken()
+    {
+      return firstToken;
+    }
 
-        string getRestOfLine()
-        {
-            return restOfTheLine;
-        }
+    string getRestOfLine()
+    {
+      return restOfTheLine;
+    }
 
-        void resetCurrentPosition(uint32_t cp=0)
-        {
-            if( cp >=0 && cp <= vTokenList.size() )
-            {
-                currentPosition=cp;
-            }
-        }
+    void resetCurrentPosition(uint32_t cp=0)
+    {
+      if( cp >=0 && cp <= vTokenList.size() )
+      {
+        currentPosition=cp;
+      }
+    }
 
-        string getNextToken()
-        {
-            if(currentPosition >= 0 && currentPosition <= (vTokenList.size()-1))
-            {
-                return vTokenList[currentPosition++];
-            }
-            return "";
-        }
+    string getNextToken()
+    {
+      if(currentPosition >= 0 && currentPosition <= (vTokenList.size()-1))
+      {
+        return vTokenList[currentPosition++];
+      }
+      return "";
+    }
 
-        uint32_t getTokenNumber()
-        {
-            return tokenList.size();
-        }
+    uint32_t getTokenNumber()
+    {
+      return tokenList.size();
+    }
 
-        string getToken(int position)
-        {
-            if( position >=0 && position <vTokenList.size() )
-            {
-                return vTokenList[position];
-            }
-            return "";
-        }
+    string getToken(int position)
+    {
+      if( position >=0 && position <vTokenList.size() )
+      {
+        return vTokenList[position];
+      }
+      return "";
+    }
 
-        int getTokenPosition(string& token);
-        string getTokenString(int from , int to);
-        string getTokenString(int from);
-        bool doesTokenExist(string token);
+    int getTokenPosition(string& token);
+    string getTokenString(int from , int to);
+    string getTokenString(int from);
+    bool doesTokenExist(string token);
 
 
-    private:
+  private:
 
-        void makeToken();
-        void insertToken(const string& token);
-        void makeRestOfTheLine();
+    void makeToken();
+    void insertToken(const string& token);
+    void makeRestOfTheLine();
 
-        string seps;
-        string originalString;
-        string firstToken;
-        string restOfTheLine;
-        std::list<string> tokenList;
-        std::vector<string> vTokenList;
-        uint32_t currentPosition;
-    };
+    string seps;
+    string originalString;
+    string firstToken;
+    string restOfTheLine;
+    std::list<string> tokenList;
+    std::vector<string> vTokenList;
+    uint32_t currentPosition;
+  };
 
 }//namespace nlsr
 #endif
