diff --git a/src/contact-storage.cpp b/src/contact-storage.cpp
index d5aeee8..aaf8b79 100644
--- a/src/contact-storage.cpp
+++ b/src/contact-storage.cpp
@@ -191,7 +191,7 @@
 
 shared_ptr<Profile>
 ContactStorage::getSelfProfile()
-{  
+{
   shared_ptr<Profile> profile = make_shared<Profile>(m_identity);
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "SELECT profile_type, profile_value FROM SelfProfile", -1, &stmt, 0);
@@ -249,7 +249,7 @@
   const Block &block = endorseCertificate.wireEncode();
   sqlite3_bind_text(stmt, 3, reinterpret_cast<const char*>(block.wire()), block.size(), SQLITE_TRANSIENT);
   int res = sqlite3_step (stmt);
-  sqlite3_finalize (stmt); 
+  sqlite3_finalize (stmt);
   return;
 }
 
@@ -288,18 +288,18 @@
   while( sqlite3_step (stmt) == SQLITE_ROW)
     {
       std::string profileType(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
-      endorseList.push_back(profileType);      
+      endorseList.push_back(profileType);
     }
-  sqlite3_finalize (stmt);  
+  sqlite3_finalize (stmt);
 }
 
 
-void 
+void
 ContactStorage::removeContact(const Name& identityName)
 {
   std::string identity = identityName.toUri();
-  
-  sqlite3_stmt *stmt;  
+
+  sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "DELETE FROM Contact WHERE contact_namespace=?", -1, &stmt, 0);
   sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
   int res = sqlite3_step (stmt);
@@ -309,13 +309,13 @@
   sqlite3_bind_text(stmt, 1, identity.c_str(),  identity.size (), SQLITE_TRANSIENT);
   res = sqlite3_step (stmt);
   sqlite3_finalize (stmt);
-  
+
   sqlite3_prepare_v2 (m_db, "DELETE FROM TrustScope WHERE contact_namespace=?", -1, &stmt, 0);
   sqlite3_bind_text(stmt, 1, identity.c_str(),  identity.size (), SQLITE_TRANSIENT);
   res = sqlite3_step (stmt);
-  sqlite3_finalize (stmt);         
+  sqlite3_finalize (stmt);
 }
-  
+
 void
 ContactStorage::addContact(const Contact& contact)
 {
@@ -325,9 +325,9 @@
   std::string identity = contact.getNameSpace().toUri();
   bool isIntroducer = contact.isIntroducer();
 
-  sqlite3_stmt *stmt;  
-  sqlite3_prepare_v2 (m_db, 
-                      "INSERT INTO Contact (contact_namespace, contact_alias, contact_keyName, contact_key, notBefore, notAfter, is_introducer) values (?, ?, ?, ?, ?, ?, ?)", 
+  sqlite3_stmt *stmt;
+  sqlite3_prepare_v2 (m_db,
+                      "INSERT INTO Contact (contact_namespace, contact_alias, contact_keyName, contact_key, notBefore, notAfter, is_introducer) values (?, ?, ?, ?, ?, ?, ?)",
                       -1,
                       &stmt,
                       0);
@@ -351,10 +351,10 @@
 
   for(; it != profile.end(); it++)
     {
-      sqlite3_prepare_v2 (m_db, 
-                          "INSERT INTO ContactProfile (profile_identity, profile_type, profile_value, endorse) values (?, ?, ?, 0)", 
-                          -1, 
-                          &stmt, 
+      sqlite3_prepare_v2 (m_db,
+                          "INSERT INTO ContactProfile (profile_identity, profile_type, profile_value, endorse) values (?, ?, ?, 0)",
+                          -1,
+                          &stmt,
                           0);
       sqlite3_bind_text(stmt, 1, identity.c_str(),  identity.size (), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 2, it->first.c_str(), it->first.size(), SQLITE_TRANSIENT);
@@ -370,15 +370,15 @@
 
       while(it != end)
         {
-          sqlite3_prepare_v2 (m_db, 
-                              "INSERT INTO TrustScope (contact_namespace, trust_scope) values (?, ?)", 
-                              -1, 
-                              &stmt, 
+          sqlite3_prepare_v2 (m_db,
+                              "INSERT INTO TrustScope (contact_namespace, trust_scope) values (?, ?)",
+                              -1,
+                              &stmt,
                               0);
           sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
           sqlite3_bind_text(stmt, 2, it->first.toUri().c_str(), it->first.toUri().size(), SQLITE_TRANSIENT);
           res = sqlite3_step (stmt);
-          sqlite3_finalize (stmt);          
+          sqlite3_finalize (stmt);
           it++;
         }
     }
@@ -410,7 +410,7 @@
 
   sqlite3_prepare_v2 (m_db, "SELECT profile_type, profile_value FROM ContactProfile where profile_identity=?", -1, &stmt, 0);
   sqlite3_bind_text (stmt, 1, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
-  
+
   while(sqlite3_step (stmt) == SQLITE_ROW)
     {
       std::string type(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
@@ -449,7 +449,7 @@
   return;
 }
 
-void 
+void
 ContactStorage::updateAlias(const Name& identity, std::string alias)
 {
   sqlite3_stmt *stmt;
@@ -465,20 +465,20 @@
 ContactStorage::doesContactExist(const Name& name)
 {
   bool result = false;
-  
+
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "SELECT count(*) FROM Contact WHERE contact_namespace=?", -1, &stmt, 0);
   sqlite3_bind_text(stmt, 1, name.toUri().c_str(), name.toUri().size(), SQLITE_TRANSIENT);
 
   int res = sqlite3_step (stmt);
-    
+
   if (res == SQLITE_ROW)
     {
       int countAll = sqlite3_column_int (stmt, 0);
       if (countAll > 0)
         result = true;
-    } 
-  sqlite3_finalize (stmt); 
+    }
+  sqlite3_finalize (stmt);
   return result;
 }
 
@@ -489,7 +489,7 @@
 
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "SELECT contact_namespace FROM Contact", -1, &stmt, 0);
-  
+
   while(sqlite3_step (stmt) == SQLITE_ROW)
     {
       std::string identity(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes(stmt, 0));
@@ -508,16 +508,16 @@
 }
 
 void
-ContactStorage::updateDnsData(const Block& data, 
-                              const std::string& name, 
-                              const std::string& type, 
+ContactStorage::updateDnsData(const Block& data,
+                              const std::string& name,
+                              const std::string& type,
                               const std::string& dataName)
-{  
+{
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "INSERT OR REPLACE INTO DnsData (dns_name, dns_type, dns_value, data_name) VALUES (?, ?, ?, ?)", -1, &stmt, 0);
   sqlite3_bind_text(stmt, 1, name.c_str(), name.size(), SQLITE_TRANSIENT);
   sqlite3_bind_text(stmt, 2, type.c_str(), type.size(), SQLITE_TRANSIENT);
-  sqlite3_bind_text(stmt, 3, reinterpret_cast<const char*>(data.wire()), data.size(), SQLITE_TRANSIENT); 
+  sqlite3_bind_text(stmt, 3, reinterpret_cast<const char*>(data.wire()), data.size(), SQLITE_TRANSIENT);
   sqlite3_bind_text(stmt, 4, dataName.c_str(), dataName.size(), SQLITE_TRANSIENT);
   int res = sqlite3_step(stmt);
 
@@ -533,7 +533,7 @@
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "SELECT dns_value FROM DnsData where data_name=?", -1, &stmt, 0);
   sqlite3_bind_text(stmt, 1, dataName.toUri().c_str(), dataName.toUri().size(), SQLITE_TRANSIENT);
-  
+
   if(sqlite3_step (stmt) == SQLITE_ROW)
     {
       data = make_shared<Data>();
@@ -553,7 +553,7 @@
   sqlite3_prepare_v2 (m_db, "SELECT dns_value FROM DnsData where dns_name=? and dns_type=?", -1, &stmt, 0);
   sqlite3_bind_text(stmt, 1, name.c_str(), name.size(), SQLITE_TRANSIENT);
   sqlite3_bind_text(stmt, 2, type.c_str(), type.size(), SQLITE_TRANSIENT);
-  
+
   if(sqlite3_step (stmt) == SQLITE_ROW)
     {
       data = make_shared<Data>();
