diff --git a/src/addcontactpanel.cpp b/src/addcontactpanel.cpp
index 80675ea..b1cec57 100644
--- a/src/addcontactpanel.cpp
+++ b/src/addcontactpanel.cpp
@@ -70,7 +70,7 @@
 AddContactPanel::onAddClicked()
 {
   ContactItem contactItem(*m_currentEndorseCertificate);
-  m_contactManager->getContactStorage()->addNormalContact(contactItem);
+  m_contactManager->getContactStorage()->addContact(contactItem);
   emit newContactAdded();
   this->close();
 }
diff --git a/src/contact-item.cpp b/src/contact-item.cpp
index b737daa..eb342d6 100644
--- a/src/contact-item.cpp
+++ b/src/contact-item.cpp
@@ -22,9 +22,10 @@
 INIT_LOGGER("ContactItem");
 
 ContactItem::ContactItem(const EndorseCertificate& selfEndorseCertificate,
+                         bool isIntroducer,
                          const string& alias)
   : m_selfEndorseCertificate(selfEndorseCertificate)
-  , m_isIntroducer(false)
+  , m_isIntroducer(isIntroducer)
 {
   Name endorsedkeyName = selfEndorseCertificate.getPublicKeyName();
   Ptr<const signature::Sha256WithRsa> endorseSig = boost::dynamic_pointer_cast<const signature::Sha256WithRsa>(selfEndorseCertificate.getSignature());
@@ -72,6 +73,18 @@
   , m_alias(contactItem.m_alias)
   , m_name(contactItem.m_name)
   , m_institution(contactItem.m_institution)
-  , m_isIntroducer(false)
+  , m_isIntroducer(contactItem.m_isIntroducer)
+  , m_trustScope(contactItem.m_trustScope)
+  , m_trustScopeName(contactItem.m_trustScopeName)
 {}
 
+bool 
+ContactItem::canBeTrustedFor(const Name& name)
+{
+  vector<Ptr<Regex> >::iterator it = m_trustScope.begin();
+
+  for(; it != m_trustScope.end(); it++)
+    if((*it)->match(name))
+      return true;
+  return false;
+}
diff --git a/src/contact-item.h b/src/contact-item.h
index 4dada26..fcf24a1 100644
--- a/src/contact-item.h
+++ b/src/contact-item.h
@@ -12,6 +12,7 @@
 #define LINKNDN_CONTACT_ITEM_H
 
 #include <ndn.cxx/data.h>
+#include <ndn.cxx/regex/regex.h>
 #include <vector>
 #include "endorse-certificate.h"
 
@@ -21,6 +22,7 @@
 
 public:
   ContactItem(const EndorseCertificate& selfEndorseCertificate,
+              bool isIntroducer = false,
               const std::string& alias = std::string());
 
   ContactItem(const ContactItem& contactItem);
@@ -53,9 +55,23 @@
   { return m_selfEndorseCertificate.getPublicKeyName(); }
 
   inline bool
-  isIntroducer()
+  isIntroducer() const
   { return m_isIntroducer; }
 
+  void
+  addTrustScope(const ndn::Name& nameSpace)
+  {
+    m_trustScopeName.push_back(nameSpace);
+    m_trustScope.push_back(ndn::Regex::fromName(nameSpace)); 
+  }
+
+  bool
+  canBeTrustedFor(const ndn::Name& name);
+
+  inline const std::vector<ndn::Name>&
+  getTrustScopeList() const
+  { return m_trustScopeName; }
+
 protected:
   EndorseCertificate m_selfEndorseCertificate;
 
@@ -66,6 +82,9 @@
   std::string m_institution;
 
   bool m_isIntroducer;
+
+  std::vector<ndn::Ptr<ndn::Regex> > m_trustScope;
+  std::vector<ndn::Name> m_trustScopeName;
 };
 
 #endif
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index 9bd8ca2..2c30921 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -161,31 +161,11 @@
 
 vector<Ptr<ContactItem> >
 ContactManager::getContactItemList()
-{
-  vector<Ptr<ContactItem> > result;
-  
-  vector<Ptr<ContactItem> > ncList = m_contactStorage->getAllNormalContacts();
-  vector<Ptr<TrustedContact> > tcList = m_contactStorage->getAllTrustedContacts();
-
-  result.insert(result.end(), tcList.begin(), tcList.end());
-  result.insert(result.end(), ncList.begin(), ncList.end());
-
-  return result;
-}
+{ return m_contactStorage->getAllContacts(); }
 
 Ptr<ContactItem>
 ContactManager::getContact(const ndn::Name& contactNamespace)
-{
-  Ptr<ContactItem> contactItem = m_contactStorage->getNormalContact(contactNamespace);
-  if(NULL != contactItem)
-    return contactItem;
-  
-  contactItem = m_contactStorage->getTrustedContact(contactNamespace);
-  if(NULL != contactItem)
-    return contactItem;
-  
-  return NULL;
-}
+{ return m_contactStorage->getContact(contactNamespace); }
 
 Ptr<EndorseCertificate>
 ContactManager::getSignedSelfEndorseCertificate(const Name& identity,
diff --git a/src/contact-storage.cpp b/src/contact-storage.cpp
index 7a24fdc..073eaa1 100644
--- a/src/contact-storage.cpp
+++ b/src/contact-storage.cpp
@@ -45,31 +45,30 @@
 CREATE INDEX se_index ON SelfEndorse(identity);                      \n \
 ";
 
-const string INIT_TC_TABLE = "\
+const string INIT_CONTACT_TABLE = "\
 CREATE TABLE IF NOT EXISTS                                           \n \
-  TrustedContact(                                                    \n \
+  Contact(                                                           \n \
       contact_namespace BLOB NOT NULL,                               \n \
       contact_alias     BLOB NOT NULL,                               \n \
       self_certificate  BLOB NOT NULL,                               \n \
-      trust_scope       BLOB NOT NULL,                               \n \
+      is_introducer     INTEGER DEFAULT 0,                           \n \
                                                                      \
       PRIMARY KEY (contact_namespace)                                \n \
   );                                                                 \n \
                                                                      \
-CREATE INDEX tc_index ON TrustedContact(contact_namespace);          \n \
+CREATE INDEX contact_index ON TrustedContact(contact_namespace);     \n \
 ";
 
-const string INIT_NC_TABLE = "\
+const string INIT_TS_TABLE = "\
 CREATE TABLE IF NOT EXISTS                                           \n \
-  NormalContact(                                                     \n \
+  TrustScope(                                                        \n \
       contact_namespace BLOB NOT NULL,                               \n \
-      contact_alias     BLOB NOT NULL,                               \n \
-      self_certificate  BLOB NOT NULL,                               \n \
+      trust_scope       BLOB NOT NULL,                               \n \
                                                                      \
-      PRIMARY KEY (contact_namespace)                                \n \
+      PRIMARY KEY (contact_namespace, trust_scope)                   \n \
   );                                                                 \n \
                                                                      \
-CREATE INDEX nc_index ON NormalContact(contact_namespace);           \n \
+CREATE INDEX ts_index ON TrustedContact(contact_namespace);          \n \
 ";
 
 ContactStorage::ContactStorage()
@@ -118,38 +117,37 @@
 
 
   // Check if TrustedContact table exists
-  sqlite3_prepare_v2 (m_db, "SELECT name FROM sqlite_master WHERE type='table' And name='TrustedContact'", -1, &stmt, 0);
+  sqlite3_prepare_v2 (m_db, "SELECT name FROM sqlite_master WHERE type='table' And name='Contact'", -1, &stmt, 0);
   res = sqlite3_step (stmt);
 
-  bool tcTableExist = false;
+  bool contactTableExist = false;
   if (res == SQLITE_ROW)
-      tcTableExist = true;
+      contactTableExist = true;
   sqlite3_finalize (stmt);
 
-  if(!tcTableExist)
+  if(!contactTableExist)
     {
       char *errmsg = 0;
-      res = sqlite3_exec (m_db, INIT_TC_TABLE.c_str (), NULL, NULL, &errmsg);
+      res = sqlite3_exec (m_db, INIT_CONTACT_TABLE.c_str (), NULL, NULL, &errmsg);
       if (res != SQLITE_OK && errmsg != 0)
-        throw LnException("Init \"error\" in TrustedContact");
+        throw LnException("Init \"error\" in Contact");
     }
-    
-  // Check if NormalContact table exists
-  sqlite3_prepare_v2 (m_db, "SELECT name FROM sqlite_master WHERE type='table' And name='NormalContact'", -1, &stmt, 0);
+
+  // Check if TrustedContact table exists
+  sqlite3_prepare_v2 (m_db, "SELECT name FROM sqlite_master WHERE type='table' And name='TrustScope'", -1, &stmt, 0);
   res = sqlite3_step (stmt);
 
-  bool ncTableExist = false;
+  bool tsTableExist = false;
   if (res == SQLITE_ROW)
-      ncTableExist = true;
+      tsTableExist = true;
   sqlite3_finalize (stmt);
 
-  if(!ncTableExist)
+  if(!tsTableExist)
     {
       char *errmsg = 0;
-      res = sqlite3_exec (m_db, INIT_NC_TABLE.c_str (), NULL, NULL, &errmsg);
-        
+      res = sqlite3_exec (m_db, INIT_TS_TABLE.c_str (), NULL, NULL, &errmsg);
       if (res != SQLITE_OK && errmsg != 0)
-        throw LnException("Init \"error\" in NormalContact");
+        throw LnException("Init \"error\" in TrustScope");
     }
 }
 
@@ -218,89 +216,73 @@
 
   return profile;
 }
-
-void
-ContactStorage::addTrustedContact(const TrustedContact& trustedContact)
-{
-  if(doesTrustedContactExist(trustedContact.getNameSpace()))
-    throw LnException("Trusted Contact has already existed");
-  
-  sqlite3_stmt *stmt;  
-  sqlite3_prepare_v2 (m_db, 
-                      "INSERT INTO TrustedContact (contact_namespace, contact_alias, self_certificate, trust_scope) values (?, ?, ?, ?)", 
-                      -1, 
-                      &stmt, 
-                      0);
-  
-  sqlite3_bind_text(stmt, 1, trustedContact.getNameSpace().toUri().c_str(),  trustedContact.getNameSpace().toUri().size (), SQLITE_TRANSIENT);
-  sqlite3_bind_text(stmt, 2, trustedContact.getAlias().c_str(), trustedContact.getAlias().size(), SQLITE_TRANSIENT);
-  Ptr<Blob> selfCertificateBlob = trustedContact.getSelfEndorseCertificate().encodeToWire();
-  sqlite3_bind_text(stmt, 3, selfCertificateBlob->buf(), selfCertificateBlob->size(), SQLITE_TRANSIENT);
-  Ptr<Blob> trustScopeBlob = trustedContact.getTrustScopeBlob();
-  sqlite3_bind_text(stmt, 4, trustScopeBlob->buf(), trustScopeBlob->size(),SQLITE_TRANSIENT);
-
-  int res = sqlite3_step (stmt);
-  sqlite3_finalize (stmt);
-}
   
 void
-ContactStorage::addNormalContact(const ContactItem& normalContact)
+ContactStorage::addContact(const ContactItem& contact)
 {
-  if(doesNormalContactExist(normalContact.getNameSpace()))
+  if(doesContactExist(contact.getNameSpace()))
     throw LnException("Normal Contact has already existed");
 
+  bool isIntroducer = contact.isIntroducer();
+
   sqlite3_stmt *stmt;  
   sqlite3_prepare_v2 (m_db, 
-                      "INSERT INTO NormalContact (contact_namespace, contact_alias, self_certificate) values (?, ?, ?)", 
+                      "INSERT INTO Contact (contact_namespace, contact_alias, self_certificate, is_introducer) values (?, ?, ?, ?)", 
                       -1, 
                       &stmt, 
                       0);
 
-  sqlite3_bind_text(stmt, 1, normalContact.getNameSpace().toUri().c_str(),  normalContact.getNameSpace().toUri().size (), SQLITE_TRANSIENT);
-  sqlite3_bind_text(stmt, 2, normalContact.getAlias().c_str(), normalContact.getAlias().size(), SQLITE_TRANSIENT);
-  Ptr<Blob> selfCertificateBlob = normalContact.getSelfEndorseCertificate().encodeToWire();
+  sqlite3_bind_text(stmt, 1, contact.getNameSpace().toUri().c_str(),  contact.getNameSpace().toUri().size (), SQLITE_TRANSIENT);
+  sqlite3_bind_text(stmt, 2, contact.getAlias().c_str(), contact.getAlias().size(), SQLITE_TRANSIENT);
+  Ptr<Blob> selfCertificateBlob = contact.getSelfEndorseCertificate().encodeToWire();
   sqlite3_bind_text(stmt, 3, selfCertificateBlob->buf(), selfCertificateBlob->size(), SQLITE_TRANSIENT);
+  sqlite3_bind_int(stmt, 4, (isIntroducer ? 1 : 0));
 
   int res = sqlite3_step (stmt);
   // _LOG_DEBUG("res " << res);
   sqlite3_finalize (stmt);
+
+  if(isIntroducer)
+    {
+      const vector<Name>& scopeList = contact.getTrustScopeList();
+      vector<Name>::const_iterator it = scopeList.begin();
+      string nameSpace = contact.getNameSpace().toUri();
+      
+      while(it != scopeList.end())
+        {
+          sqlite3_prepare_v2 (m_db, 
+                              "INSERT INTO TrustScope (contact_namespace, trust_scope) values (?, ?)", 
+                              -1, 
+                              &stmt, 
+                              0);
+          sqlite3_bind_text(stmt, 1, nameSpace.c_str(),  nameSpace.size (), SQLITE_TRANSIENT);
+          sqlite3_bind_text(stmt, 2, it->toUri().c_str(), it->toUri().size(), SQLITE_TRANSIENT);
+          res = sqlite3_step (stmt);
+          sqlite3_finalize (stmt);          
+          it++;
+        }
+    }
 }
 
 void 
 ContactStorage::updateAlias(const ndn::Name& identity, std::string alias)
 {
-  if(doesNormalContactExist(identity))
-    {
-      sqlite3_stmt *stmt;
-      sqlite3_prepare_v2 (m_db, "UPDATE NormalContact SET contact_alias=? WHERE contact_namespace=?", -1, &stmt, 0);
-      sqlite3_bind_text(stmt, 1, alias.c_str(), alias.size(), SQLITE_TRANSIENT);
-      sqlite3_bind_text(stmt, 2, identity.toUri().c_str(),  identity.toUri().size (), SQLITE_TRANSIENT);
-      int res = sqlite3_step (stmt);
-      sqlite3_finalize (stmt);
-      return;
-    }
-  if(doesTrustedContactExist(identity))
-    {
-      sqlite3_stmt *stmt;
-      sqlite3_prepare_v2 (m_db, "UPDATE TrustedContact SET contact_alias=? WHERE contact_namespace=?", -1, &stmt, 0);
-      sqlite3_bind_text(stmt, 1, alias.c_str(), alias.size(), SQLITE_TRANSIENT);
-      sqlite3_bind_text(stmt, 2, identity.toUri().c_str(),  identity.toUri().size (), SQLITE_TRANSIENT);
-      int res = sqlite3_step (stmt);
-      sqlite3_finalize (stmt);
-      return;
-    }
+  sqlite3_stmt *stmt;
+  sqlite3_prepare_v2 (m_db, "UPDATE Contact SET contact_alias=? WHERE contact_namespace=?", -1, &stmt, 0);
+  sqlite3_bind_text(stmt, 1, alias.c_str(), alias.size(), SQLITE_TRANSIENT);
+  sqlite3_bind_text(stmt, 2, identity.toUri().c_str(),  identity.toUri().size (), SQLITE_TRANSIENT);
+  int res = sqlite3_step (stmt);
+  sqlite3_finalize (stmt);
+  return;
 }
 
 bool
-ContactStorage::doesContactExist(const Name& name, bool normal)
+ContactStorage::doesContactExist(const Name& name)
 {
   bool result = false;
   
   sqlite3_stmt *stmt;
-  if(normal)
-    sqlite3_prepare_v2 (m_db, "SELECT count(*) FROM NormalContact WHERE contact_namespace=?", -1, &stmt, 0);
-  else
-    sqlite3_prepare_v2 (m_db, "SELECT count(*) FROM TrustedContact WHERE contact_namespace=?", -1, &stmt, 0);
+  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);
@@ -315,43 +297,13 @@
   return result;
 }
 
-vector<Ptr<TrustedContact> >
-ContactStorage::getAllTrustedContacts() const
-{
-  vector<Ptr<TrustedContact> > trustedContacts;
-
-  sqlite3_stmt *stmt;
-  sqlite3_prepare_v2 (m_db, 
-                      "SELECT contact_alias, self_certificate, trust_scope FROM TrustedContact", 
-                      -1, 
-                      &stmt, 
-                      0);
-  
-  while( sqlite3_step (stmt) == SQLITE_ROW)
-    {
-      string alias(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
-      Ptr<Blob> certBlob = Ptr<Blob>(new Blob(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1)));
-      Ptr<Data> certData = Data::decodeFromWire(certBlob);
-      EndorseCertificate endorseCertificate(*certData);
-      string trustScope(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 2)), sqlite3_column_bytes (stmt, 2));
-
-      trustedContacts.push_back(Ptr<TrustedContact>(new TrustedContact(endorseCertificate, trustScope, alias)));      
-    }
-
-  return trustedContacts;
-}
-
 vector<Ptr<ContactItem> >
-ContactStorage::getAllNormalContacts() const
+ContactStorage::getAllContacts() const
 {
-  vector<Ptr<ContactItem> > normalContacts;
+  vector<Ptr<ContactItem> > contacts;
 
   sqlite3_stmt *stmt;
-  sqlite3_prepare_v2 (m_db, 
-                      "SELECT contact_alias, self_certificate FROM NormalContact", 
-                      -1, 
-                      &stmt, 
-                      0);
+  sqlite3_prepare_v2 (m_db, "SELECT contact_alias, self_certificate, is_introducer FROM Contact", -1, &stmt, 0);
   
   while( sqlite3_step (stmt) == SQLITE_ROW)
     {
@@ -359,22 +311,37 @@
       Ptr<Blob> certBlob = Ptr<Blob>(new Blob(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1)));
       Ptr<Data> certData = Data::decodeFromWire(certBlob);
       EndorseCertificate endorseCertificate(*certData);
+      int isIntroducer = sqlite3_column_int (stmt, 2);
 
-      normalContacts.push_back(Ptr<ContactItem>(new ContactItem(endorseCertificate, alias)));      
+      contacts.push_back(Ptr<ContactItem>(new ContactItem(endorseCertificate, isIntroducer, alias)));      
     }
-  
-  return normalContacts;
+  sqlite3_finalize (stmt);  
+
+  vector<Ptr<ContactItem> >::iterator it = contacts.begin();
+  for(; it != contacts.end(); it++)
+    {
+      if((*it)->isIntroducer())
+        {
+          sqlite3_prepare_v2 (m_db, "SELECT trust_scope FROM TrustScope WHERE contact_namespace=?", -1, &stmt, 0);
+          sqlite3_bind_text(stmt, 1, (*it)->getNameSpace().toUri().c_str(), (*it)->getNameSpace().toUri().size(), SQLITE_TRANSIENT);
+
+          while( sqlite3_step (stmt) == SQLITE_ROW)
+            {
+              Name scope(string(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0)));
+              (*it)->addTrustScope(scope);
+            }
+          sqlite3_finalize (stmt);  
+        }
+    }
+
+  return contacts;
 }
 
 Ptr<ContactItem>
-ContactStorage::getNormalContact(const Name& name)
+ContactStorage::getContact(const Name& name)
 {
   sqlite3_stmt *stmt;
-  sqlite3_prepare_v2 (m_db, 
-                      "SELECT contact_alias, self_certificate FROM NormalContact where contact_namespace=?", 
-                      -1, 
-                      &stmt, 
-                      0);
+  sqlite3_prepare_v2 (m_db, "SELECT contact_alias, self_certificate, is_introducer FROM Contact where contact_namespace=?", -1, &stmt, 0);
   sqlite3_bind_text (stmt, 1, name.toUri().c_str(), name.toUri().size(), SQLITE_TRANSIENT);
   
   if( sqlite3_step (stmt) == SQLITE_ROW)
@@ -383,36 +350,13 @@
       Ptr<Blob> certBlob = Ptr<Blob>(new Blob(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1)));
       Ptr<Data> certData = Data::decodeFromWire(certBlob);
       EndorseCertificate endorseCertificate(*certData);
+      int isIntroducer = sqlite3_column_int (stmt, 2);
 
-      return Ptr<ContactItem>(new ContactItem(endorseCertificate, alias));      
+      return Ptr<ContactItem>(new ContactItem(endorseCertificate, isIntroducer, alias));      
     } 
   return NULL;
 }
 
-Ptr<TrustedContact>
-ContactStorage::getTrustedContact(const Name& name)
-{
-  sqlite3_stmt *stmt;
-  sqlite3_prepare_v2 (m_db, 
-                      "SELECT contact_alias, self_certificate, trust_scope FROM TrustedContact where contact_namespace=?", 
-                      -1, 
-                      &stmt, 
-                      0);
-  sqlite3_bind_text (stmt, 1, name.toUri().c_str(), name.toUri().size(), SQLITE_TRANSIENT);
-  
-  if( sqlite3_step (stmt) == SQLITE_ROW)
-    {
-      string alias(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
-      Ptr<Blob> certBlob = Ptr<Blob>(new Blob(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1)));
-      Ptr<Data> certData = Data::decodeFromWire(certBlob);
-      EndorseCertificate endorseCertificate(*certData);
-      string trustScope(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 2)), sqlite3_column_bytes (stmt, 2));
-
-      return Ptr<TrustedContact>(new TrustedContact(endorseCertificate, trustScope, alias));      
-    }
-  return NULL;
-}
-
 Ptr<Profile>
 ContactStorage::getSelfProfile(const Name& identity) const
 {  
diff --git a/src/contact-storage.h b/src/contact-storage.h
index d0f5f5b..882dff5 100644
--- a/src/contact-storage.h
+++ b/src/contact-storage.h
@@ -12,7 +12,6 @@
 #define LINKNDN_CONTACT_STORAGE_H
 
 #include <sqlite3.h>
-#include "trusted-contact.h"
 #include "contact-item.h"
 #include "endorse-certificate.h"
 #include <ndn.cxx/security/identity/identity-manager.h>
@@ -35,25 +34,16 @@
   getSelfProfile(const ndn::Name& identity);
 
   void
-  addTrustedContact(const TrustedContact& trustedContact);
-  
-  void
-  addNormalContact(const ContactItem& contactItem);
+  addContact(const ContactItem& contactItem);
 
   void 
   updateAlias(const ndn::Name& identity, std::string alias);
 
-  std::vector<ndn::Ptr<TrustedContact> >
-  getAllTrustedContacts() const;
-
   std::vector<ndn::Ptr<ContactItem> >
-  getAllNormalContacts() const;
+  getAllContacts() const;
 
   ndn::Ptr<ContactItem>
-  getNormalContact(const ndn::Name& name);
-
-  ndn::Ptr<TrustedContact>
-  getTrustedContact(const ndn::Name& name);
+  getContact(const ndn::Name& name);
     
   ndn::Ptr<Profile>
   getSelfProfile(const ndn::Name& identity) const;
@@ -71,16 +61,8 @@
   bool
   doesSelfEntryExist(const ndn::Name& identity, const std::string& profileType);
 
-  inline bool
-  doesTrustedContactExist(const ndn::Name& name)
-  { return doesContactExist(name, false); }
-
-  inline bool
-  doesNormalContactExist(const ndn::Name& name)
-  { return doesContactExist(name, true); }
-
   bool
-  doesContactExist(const ndn::Name& name, bool normal);
+  doesContactExist(const ndn::Name& name);
 
 private:
   sqlite3 *m_db;
diff --git a/src/contactpanel.cpp b/src/contactpanel.cpp
index 7940145..cc44a37 100644
--- a/src/contactpanel.cpp
+++ b/src/contactpanel.cpp
@@ -323,7 +323,6 @@
       ui->isIntroducer->setChecked(true);
       ui->addScope->setEnabled(true);
       ui->deleteScope->setEnabled(true);
-      Ptr<TrustedContact> trustedContact = boost::dynamic_pointer_cast<TrustedContact>(m_currentSelectedContact);      
       m_currentContactTrustScopeListModel = new QStringListModel;
     }
   else
@@ -487,11 +486,9 @@
     {
       ui->addScope->setEnabled(true);
       ui->deleteScope->setEnabled(true);
-      Ptr<TrustedContact> trustedContact = boost::dynamic_pointer_cast<TrustedContact>(m_currentSelectedContact);      
     }
   else
     {
-      ui->isIntroducer->setChecked(false);
       ui->addScope->setEnabled(false);
       ui->deleteScope->setEnabled(false);
     }
diff --git a/src/trusted-contact.cpp b/src/trusted-contact.cpp
deleted file mode 100644
index 9e574b7..0000000
--- a/src/trusted-contact.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#include "trusted-contact.h"
-#include <boost/tokenizer.hpp>
-using boost::tokenizer;
-using boost::escaped_list_separator;
-
-using namespace std;
-using namespace ndn;
-
-TrustedContact::TrustedContact(const EndorseCertificate& selfEndorseCertificate,
-			       const string& trustScope,
-			       const string& alias)
-  : ContactItem(selfEndorseCertificate, alias)
-{
-  m_isIntroducer = true;
-
-  tokenizer<escaped_list_separator<char> > trustScopeItems(trustScope, escaped_list_separator<char> ("\\", " \t", "'\""));
-
-  tokenizer<escaped_list_separator<char> >::iterator it = trustScopeItems.begin();
-
-  while (it != trustScopeItems.end())
-    {
-      m_trustScope.push_back(Regex::fromName(Name(*it)));
-      m_trustScopeName.push_back(Name(*it));
-      it++;
-    }
-}
-
-TrustedContact::TrustedContact(const ContactItem& contactItem)
-  : ContactItem(contactItem)
-{
-  m_isIntroducer = true;
-}
-
-TrustedContact::TrustedContact(const TrustedContact& trustedContact)
-  : ContactItem(trustedContact)
-  , m_trustScope(trustedContact.m_trustScope)
-  , m_trustScopeName(trustedContact.m_trustScopeName)
-{
-  m_isIntroducer = true;
-}
-
-bool 
-TrustedContact::canBeTrustedFor(const Name& name)
-{
-  vector<Ptr<Regex> >::iterator it = m_trustScope.begin();
-
-  for(; it != m_trustScope.end(); it++)
-    if((*it)->match(name))
-      return true;
-  return false;
-}
-
-Ptr<Blob> 
-TrustedContact::getTrustScopeBlob() const
-{
-  ostringstream oss;
-
-  vector<Name>::const_iterator it = m_trustScopeName.begin();
-  if(it != m_trustScopeName.end())
-    oss << it->toUri();
-  for(; it != m_trustScopeName.end(); it++)
-    oss << " " << it->toUri();
-
-  return Ptr<Blob>(new Blob(oss.str().c_str(), oss.str().size()));
-}
-
diff --git a/src/trusted-contact.h b/src/trusted-contact.h
deleted file mode 100644
index b080dbb..0000000
--- a/src/trusted-contact.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef LINKNDN_TRUSTED_CONTACT_H
-#define LINKNDN_TRUSTED_CONTACT_H
-
-#include "contact-item.h"
-#include <ndn.cxx/regex/regex.h>
-
-class TrustedContact : public virtual ContactItem
-{
-public:
-  TrustedContact(const EndorseCertificate& selfEndorseCertificate,
-                 const std::string& trustScope,
-                 const std::string& alias = std::string());
-
-  TrustedContact(const ContactItem& contactItem);
-
-  TrustedContact(const TrustedContact& trustedContact);
- 
-  virtual
-  ~TrustedContact() {}
-
-  void
-  addTrustScope(ndn::Ptr<ndn::Regex> nameSpace)
-  { m_trustScope.push_back(nameSpace); }
-
-  bool
-  canBeTrustedFor(const ndn::Name& name);
-
-  ndn::Ptr<ndn::Blob> 
-  getTrustScopeBlob() const;
-
-  inline const std::vector<ndn::Name>&
-  getTrustScopeList() const
-  { return m_trustScopeName; }
-
-private:
-  std::vector<ndn::Ptr<ndn::Regex> > m_trustScope;
-  std::vector<ndn::Name> m_trustScopeName;
-};
-
-#endif
