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
