diff --git a/src/chatdialog.cpp b/src/chatdialog.cpp
index 4ecb7db..17ec238 100644
--- a/src/chatdialog.cpp
+++ b/src/chatdialog.cpp
@@ -37,6 +37,8 @@
                        const ndn::Name& chatroomPrefix,
 		       const ndn::Name& localPrefix,
                        const ndn::Name& defaultIdentity,
+                       const std::string& nick,
+                       bool trial,
 		       QWidget *parent) 
 : QDialog(parent)
   , ui(new Ui::ChatDialog)
@@ -45,6 +47,7 @@
   , m_localPrefix(localPrefix)
   , m_defaultIdentity(defaultIdentity)
   , m_invitationPolicyManager(ndn::Ptr<InvitationPolicyManager>(new InvitationPolicyManager(m_chatroomPrefix.get(-1).toUri())))
+  , m_nick(nick)
   , m_sock(NULL)
   , m_lastMsgTime(0)
   // , m_historyInitialized(false)
@@ -57,7 +60,7 @@
   ui->setupUi(this);
 
   m_localChatPrefix = m_localPrefix;
-  m_localChatPrefix.append("FH").append(m_defaultIdentity);
+  m_localChatPrefix.append("%F0.").append(m_defaultIdentity);
   m_localChatPrefix.append("chronos").append(m_chatroomPrefix.get(-1));
 
   m_session = time(NULL);
@@ -77,7 +80,7 @@
 
   m_timer = new QTimer(this);
 
-  setWrapper();
+  setWrapper(trial);
 
   connect(ui->inviteButton, SIGNAL(clicked()),
           this, SLOT(openInviteListDialog()));
@@ -188,13 +191,18 @@
 
 ChatDialog::~ChatDialog()
 {
-  delete ui;
-  sendLeave();
-  m_handler->shutdown();
+  _LOG_DEBUG("about to leave 4!");
+  if(m_sock != NULL)
+    {
+      sendLeave();
+      delete m_sock;
+      m_sock = NULL;
+    }
+  // m_handler->shutdown();
 }
 
 void
-ChatDialog::setWrapper()
+ChatDialog::setWrapper(bool trial)
 {
   m_identityManager = ndn::Ptr<ndn::security::IdentityManager>::Create();
   // ndn::Ptr<ndn::security::EncryptionManager> encryptionManager = ndn::Ptr<ndn::security::EncryptionManager>(new ndn::security::BasicEncryptionManager(privateStorage, "/tmp/encryption.db"));
@@ -205,13 +213,30 @@
   m_keychain = ndn::Ptr<ndn::security::Keychain>(new ndn::security::Keychain(m_identityManager, m_invitationPolicyManager, NULL));
 
   m_handler = ndn::Ptr<ndn::Wrapper>(new ndn::Wrapper(m_keychain));
+
+  if(trial == true)
+    {
+      ndn::Ptr<ndn::Interest> interest = ndn::Ptr<ndn::Interest>(new ndn::Interest(ndn::Name("/local/ndn/prefix")));
+      ndn::Ptr<ndn::Closure> closure = ndn::Ptr<ndn::Closure>(new ndn::Closure(boost::bind(&ChatDialog::onUnverified,
+                                                                                           this,
+                                                                                           _1),
+                                                                               boost::bind(&ChatDialog::onTimeout,
+                                                                                           this,
+                                                                                           _1,
+                                                                                           _2),
+                                                                               boost::bind(&ChatDialog::onUnverified,
+                                                                                           this,
+                                                                                           _1)));
+
+      m_handler->sendInterest(interest, closure);
+    }
 }
 
 void
 ChatDialog::initializeSetting()
 {
   // TODO: nick name may be changed.
-  m_user.setNick(QString::fromStdString(m_defaultIdentity.get(-1).toUri()));
+  m_user.setNick(QString::fromStdString(m_nick));
   m_user.setChatroom(QString::fromStdString(m_chatroomPrefix.get(-1).toUri()));
   m_user.setOriginPrefix(QString::fromStdString(m_localPrefix.toUri()));
   m_user.setPrefix(QString::fromStdString(m_localChatPrefix.toUri()));
@@ -261,6 +286,8 @@
   const ndn::Blob& sigBits = sha256sig->getSignatureBits();
 
   interestName.append(sigBits.buf(), sigBits.size());
+  interestName.appendVersion();
+
 
   ndn::Ptr<ndn::Interest> interest = ndn::Ptr<ndn::Interest>(new ndn::Interest(interestName));
   ndn::Ptr<ndn::Closure> closure = ndn::Ptr<ndn::Closure>(new ndn::Closure(boost::bind(&ChatDialog::onInviteReplyVerified,
@@ -321,7 +348,10 @@
   ndn::Ptr<const ndn::signature::Sha256WithRsa> sha256sig = boost::dynamic_pointer_cast<const ndn::signature::Sha256WithRsa> (data->getSignature());
   const ndn::Name & keyLocatorName = sha256sig->getKeyLocator().getKeyName();
   ndn::Ptr<ndn::security::IdentityCertificate> dskCertificate = m_invitationPolicyManager->getValidatedDskCertificate(keyLocatorName);
-  m_syncPolicyManager->addChatDataRule(inviteePrefix, *dskCertificate, isIntroducer);
+  ndn::Name tmpPrefix(inviteePrefix);
+  ndn::Name prefix = tmpPrefix.getPrefix(tmpPrefix.size()-1);
+  m_syncPolicyManager->addChatDataRule(prefix, *dskCertificate, isIntroducer);
+  // m_syncPolicyManager->addChatDataRule(inviteePrefix, *dskCertificate, isIntroducer);
   publishIntroCert(dskCertificate, isIntroducer);
 }
 
@@ -361,6 +391,11 @@
 {}
 
 void
+ChatDialog::onTimeout(ndn::Ptr<ndn::Closure> closure, 
+                      ndn::Ptr<ndn::Interest> interest)
+{}
+
+void
 ChatDialog::initializeSync()
 {
   
@@ -970,6 +1005,16 @@
   sendInvitation(inviteeItem, isIntroducer);
 }
 
+void
+ChatDialog::closeEvent(QCloseEvent *e)
+{
+  hide();
+  _LOG_DEBUG("about to leave 1");
+  emit closeChatDialog(m_chatroomPrefix);
+}
+
+
+
 
 #if WAF
 #include "chatdialog.moc"
diff --git a/src/chatdialog.h b/src/chatdialog.h
index a4792bc..951edbb 100644
--- a/src/chatdialog.h
+++ b/src/chatdialog.h
@@ -48,6 +48,8 @@
                       const ndn::Name& chatroomPrefix,
                       const ndn::Name& localPrefix,
                       const ndn::Name& defaultIdentity,
+                      const std::string& nick,
+                      bool trial = false,
                       QWidget *parent = 0);
 
   // explicit ChatDialog(const ndn::Name& chatroomPrefix,
@@ -92,6 +94,9 @@
   void 
   processRemoveWrapper(std::string);
 
+protected:
+  void closeEvent(QCloseEvent *e);
+
 private:
 
   void
@@ -101,7 +106,7 @@
   updateLabels();
 
   void
-  setWrapper();
+  setWrapper(bool trial);
 
   void
   initializeSync();
@@ -130,6 +135,9 @@
   void
   onUnverified(ndn::Ptr<ndn::Data> data);
 
+  void
+  onTimeout(ndn::Ptr<ndn::Closure> closure, 
+            ndn::Ptr<ndn::Interest> interest);
 
 
   // void 
@@ -172,6 +180,9 @@
   void 
   removeReceived(QString prefix);
 
+  void
+  closeChatDialog(const ndn::Name& chatroomPrefix);
+
 public slots:
   void 
   processTreeUpdate(const std::vector<Sync::MissingDataInfo>);
@@ -236,6 +247,7 @@
   ndn::Ptr<ndn::Wrapper> m_handler;
 
   User m_user; 
+  std::string m_nick;
   Sync::SyncSocket *m_sock;
   uint32_t m_session;
   DigestTreeScene *m_scene;
diff --git a/src/chronos-invitation.cpp b/src/chronos-invitation.cpp
index a36634b..5a392a1 100644
--- a/src/chronos-invitation.cpp
+++ b/src/chronos-invitation.cpp
@@ -19,9 +19,10 @@
 
 INIT_LOGGER("ChronosInvitation");
 
-ChronosInvitation::ChronosInvitation(const ndn::Name& interestName)
-  : m_interestName(interestName)
+ChronosInvitation::ChronosInvitation(const ndn::Name& originalInterestName)
+  : m_interestName(originalInterestName)
 {
+  Name interestName = originalInterestName.getPrefix(originalInterestName.size()-1);
   if(interestName.get(0).toUri() != string("ndn")
      || interestName.get(1).toUri() != string("broadcast")
      || interestName.get(2).toUri() != string("chronos")
diff --git a/src/contactpanel.cpp b/src/contactpanel.cpp
index b22f460..361b7bd 100644
--- a/src/contactpanel.cpp
+++ b/src/contactpanel.cpp
@@ -49,12 +49,12 @@
   , m_startChatDialog(new StartChatDialog)
   , m_invitationDialog(new InvitationDialog)
   , m_settingDialog(new SettingDialog)
-  , m_menuInvite(new QAction("&Chat", this))
-  , m_menuAlias(new QAction("&Set Alias", this))
 {
   qRegisterMetaType<ndn::security::IdentityCertificate>("IdentityCertificate");
   qRegisterMetaType<ChronosInvitation>("ChronosInvitation");
   
+  createAction();
+
   openDB();    
 
   m_contactManager = contactManager;
@@ -63,24 +63,27 @@
   m_setAliasDialog = new SetAliasDialog(contactManager);
  
   ui->setupUi(this);
+
   refreshContactList();
 
   setKeychain();
-  m_handler = Ptr<Wrapper>(new Wrapper(m_keychain));
-   
+
+  m_defaultIdentity = m_keychain->getDefaultIdentity();
+  m_nickName = m_defaultIdentity.get(-1).toUri();
+  m_settingDialog->setIdentity(m_defaultIdentity.toUri(), m_nickName);
+
+  m_handler = Ptr<Wrapper>(new Wrapper(m_keychain));  
+
   setLocalPrefix();
     
-  // Set Identity, TODO: through user interface
-  m_defaultIdentity = m_keychain->getDefaultIdentity();
-  m_settingDialog->setIdentity(m_defaultIdentity.toUri());
   setInvitationListener();
+
   collectEndorsement();
   
   ui->ContactList->setModel(m_contactListModel);
   
-  QItemSelectionModel* selectionModel = ui->ContactList->selectionModel();
 
-  connect(selectionModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
+  connect(ui->ContactList->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
           this, SLOT(updateSelection(const QItemSelection &, const QItemSelection &)));
 
   connect(ui->ContactList, SIGNAL(customContextMenuRequested(const QPoint&)),
@@ -97,7 +100,6 @@
    
   connect(m_addContactPanel, SIGNAL(newContactAdded()),
           this, SLOT(refreshContactList()));
-
   connect(m_setAliasDialog, SIGNAL(aliasChanged()),
           this, SLOT(refreshContactList()));
 
@@ -109,8 +111,8 @@
   connect(m_invitationDialog, SIGNAL(invitationRejected(const ChronosInvitation&)),
           this, SLOT(rejectInvitation(const ChronosInvitation&)));
 
-  connect(m_settingDialog, SIGNAL(identitySet(const QString&)),
-          this, SLOT(updateDefaultIdentity(const QString&)));
+  connect(m_settingDialog, SIGNAL(identitySet(const QString&, const QString&)),
+          this, SLOT(updateDefaultIdentity(const QString&, const QString&)));
 
   connect(this, SIGNAL(newInvitationReady()),
           this, SLOT(openInvitationDialog()));
@@ -120,10 +122,8 @@
 
   connect(ui->addScope, SIGNAL(clicked()),
           this, SLOT(addScopeClicked()));
-
   connect(ui->deleteScope, SIGNAL(clicked()),
           this, SLOT(deleteScopeClicked()));
-
   connect(ui->saveButton, SIGNAL(clicked()),
           this, SLOT(saveScopeClicked()));
 
@@ -135,12 +135,20 @@
 {
   delete ui;
   delete m_contactListModel;
+  delete m_startChatDialog;
+  delete m_invitationDialog;
+  delete m_settingDialog;
+
   delete m_profileEditor;
   delete m_addContactPanel;
+  delete m_setAliasDialog;
+
   delete m_trustScopeModel;
   delete m_endorseDataModel;
+  delete m_endorseComboBoxDelegate;
 
   delete m_menuInvite;
+  delete m_menuAlias;
 
   map<Name, ChatDialog*>::iterator it = m_chatDialogs.begin();
   for(; it != m_chatDialogs.end(); it++)
@@ -148,6 +156,13 @@
 }
 
 void
+ContactPanel::createAction()
+{
+  m_menuInvite = new QAction("&Chat", this);
+  m_menuAlias = new QAction("&Set Alias", this);
+}
+
+void
 ContactPanel::openDB()
 {
   QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
@@ -155,7 +170,7 @@
   path.append(QDir::separator()).append(".chronos").append(QDir::separator()).append("chronos.db");
   db.setDatabaseName(path);
   bool ok = db.open();
-  _LOG_DEBUG("db opened: " << std::boolalpha << ok );
+  _LOG_DEBUG("DB opened: " << std::boolalpha << ok );
 
   m_trustScopeModel = new QSqlTableModel;
   m_endorseDataModel = new QSqlTableModel;
@@ -166,11 +181,10 @@
 ContactPanel::setKeychain()
 {
   m_panelPolicyManager = Ptr<PanelPolicyManager>::Create();
-  // Ptr<security::EncryptionManager> encryptionManager = Ptr<security::EncryptionManager>(new security::BasicEncryptionManager(privateStorage, "/tmp/encryption.db"));
 
   vector<Ptr<ContactItem> >::const_iterator it = m_contactList.begin();
   for(; it != m_contactList.end(); it++)
-      m_panelPolicyManager->addTrustAnchor((*it)->getSelfEndorseCertificate());
+    m_panelPolicyManager->addTrustAnchor((*it)->getSelfEndorseCertificate());
 
   m_keychain = Ptr<security::Keychain>(new security::Keychain(Ptr<security::IdentityManager>::Create(), 
                                                               m_panelPolicyManager, 
@@ -216,151 +230,32 @@
 }
 
 void
-ContactPanel::onUnverified(Ptr<Data> data)
-{}
-
-void
-ContactPanel::onTimeout(Ptr<Closure> closure, Ptr<Interest> interest)
-{}
-
-void
-ContactPanel::collectEndorsement()
-{
-  m_collectStatus = Ptr<vector<bool> >::Create();
-  m_collectStatus->assign(m_contactList.size(), false);
-  vector<Ptr<ContactItem> >::iterator it = m_contactList.begin();
-  int count = 0;
-  for(; it != m_contactList.end(); it++, count++)
-    {
-      Name interestName = (*it)->getNameSpace();
-      interestName.append("DNS").append(m_defaultIdentity).append("ENDORSEE");
-      Ptr<Interest> interest = Ptr<Interest>(new Interest(interestName));
-      interest->setChildSelector(Interest::CHILD_RIGHT);
-  
-      Ptr<Closure> closure = Ptr<Closure>(new Closure(boost::bind(&ContactPanel::onDnsEndoreeVerified, 
-                                                                  this,
-                                                                  _1,
-                                                                  count),
-                                                      boost::bind(&ContactPanel::onDnsEndoreeTimeout,
-                                                                  this,
-                                                                  _1, 
-                                                                  _2,
-                                                                  count),
-                                                      boost::bind(&ContactPanel::onDnsEndoreeUnverified,
-                                                                  this,
-                                                                  _1,
-                                                                  count)));
-
-      m_handler->sendInterest(interest, closure);
-    }
-}
-
-void
-ContactPanel::onDnsEndoreeVerified(Ptr<Data> data, int count)
-{
-  Ptr<Blob> contentBlob = Ptr<Blob>(new Blob(data->content().buf(), data->content().size()));
-  Ptr<Data> endorseData = Data::decodeFromWire(contentBlob);
-  EndorseCertificate endorseCertificate(*endorseData);
-
-  _LOG_DEBUG("get data: " << endorseCertificate.getName().toUri());
-
-  m_contactManager->getContactStorage()->updateCollectEndorse(endorseCertificate);
-
-  updateCollectStatus(count);
-}
-
-void
-ContactPanel::onDnsEndoreeTimeout(Ptr<Closure> closure, Ptr<Interest> interest, int count)
-{ updateCollectStatus(count); }
-
-void
-ContactPanel::onDnsEndoreeUnverified(Ptr<Data> data, int count)
-{ updateCollectStatus(count); }
-
-void 
-ContactPanel::updateCollectStatus(int count)
-{
-  m_collectStatus->at(count) = true;
-  vector<bool>::const_iterator it = m_collectStatus->begin();
-  for(; it != m_collectStatus->end(); it++)
-    if(*it == false)
-      return;
-
-  m_contactManager->publishEndorsedDataInDns(m_defaultIdentity);
-}
-
-void
-ContactPanel::onInvitationCertVerified(Ptr<Data> data, 
-                                       Ptr<ChronosInvitation> invitation)
-{
-  Ptr<security::IdentityCertificate> certificate = Ptr<security::IdentityCertificate>(new security::IdentityCertificate(*data));
-  
-  if(security::PolicyManager::verifySignature(invitation->getSignedBlob(), invitation->getSignatureBits(), certificate->getPublicKeyInfo()))
-    {
-      Name keyName = certificate->getPublicKeyName();
-      Name inviterNameSpace = keyName.getSubName(0, keyName.size() - 1);
-      popChatInvitation(invitation, inviterNameSpace, certificate);
-    }
-}
-
-void
-ContactPanel::popChatInvitation(Ptr<ChronosInvitation> invitation,
-                                const Name& inviterNameSpace,
-                                Ptr<security::IdentityCertificate> certificate)
-{
-  string chatroom = invitation->getChatroom().get(0).toUri();
-  string inviter = inviterNameSpace.toUri();
-
-  string alias;
-  vector<Ptr<ContactItem> >::iterator it = m_contactList.begin();
-  for(; it != m_contactList.end(); it++)
-    if((*it)->getNameSpace() == inviterNameSpace)
-      alias = (*it)->getAlias();
-
-  if(it != m_contactList.end())
-    return;
-
-  m_invitationDialog->setInvitation(alias, invitation, certificate);
-  emit newInvitationReady();
-}
-
-static std::string chars("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789");
-
-string
-ContactPanel::getRandomString()
-{
-  string randStr;
-  boost::random::random_device rng;
-  boost::random::uniform_int_distribution<> index_dist(0, chars.size() - 1);
-  for (int i = 0; i < 10; i ++)
-  {
-    randStr += chars[index_dist(rng)];
-  }
-  return randStr;
-}
-
-
-void
 ContactPanel::setInvitationListener()
 {
-  Name prefix("/ndn/broadcast/chronos/invitation");
-  prefix.append(m_defaultIdentity);
-  _LOG_DEBUG("prefix: " << prefix.toUri());
-  m_inviteListenPrefix = prefix;
-  m_handler->setInterestFilter (prefix, 
+  m_inviteListenPrefix = Name("/ndn/broadcast/chronos/invitation");
+  m_inviteListenPrefix.append(m_defaultIdentity);
+  _LOG_DEBUG("Listening for invitation on prefix: " << m_inviteListenPrefix.toUri());
+  m_handler->setInterestFilter (m_inviteListenPrefix, 
                                 boost::bind(&ContactPanel::onInvitation, 
                                             this,
                                             _1));
-
 }
 
 void
 ContactPanel::onInvitation(Ptr<Interest> interest)
 {
-  _LOG_DEBUG("receive interest!" << interest->getName().toUri());
-  const Name& interestName = interest->getName();
+  _LOG_DEBUG("Receive invitation!" << interest->getName().toUri());
 
-  Ptr<ChronosInvitation> invitation = Ptr<ChronosInvitation>(new ChronosInvitation(interestName));
+  Ptr<ChronosInvitation> invitation = Ptr<ChronosInvitation>(new ChronosInvitation(interest->getName()));
+
+  Name chatroomName("/ndn/broadcast/chronos");
+  chatroomName.append(invitation->getChatroom());
+  map<Name, ChatDialog*>::iterator it = m_chatDialogs.find(chatroomName);
+  if(it != m_chatDialogs.end())
+    {
+      _LOG_DEBUG("Exisiting chatroom!");
+      return;
+    }
 
   Ptr<Interest> newInterest = Ptr<Interest>(new Interest(invitation->getInviterCertificateName()));
   Ptr<Closure> closure = Ptr<Closure>(new Closure(boost::bind(&ContactPanel::onInvitationCertVerified, 
@@ -378,12 +273,134 @@
 }
 
 void
+ContactPanel::onInvitationCertVerified(Ptr<Data> data, 
+                                       Ptr<ChronosInvitation> invitation)
+{
+  using namespace ndn::security;
+  Ptr<IdentityCertificate> certificate = Ptr<IdentityCertificate>(new IdentityCertificate(*data));
+  
+  if(PolicyManager::verifySignature(invitation->getSignedBlob(), invitation->getSignatureBits(), certificate->getPublicKeyInfo()))
+    {
+      Name keyName = certificate->getPublicKeyName();
+      Name inviterNameSpace = keyName.getPrefix(keyName.size() - 1);
+      popChatInvitation(invitation, inviterNameSpace, certificate);
+    }
+}
+
+void
+ContactPanel::onUnverified(Ptr<Data> data)
+{}
+
+void
+ContactPanel::onTimeout(Ptr<Closure> closure, Ptr<Interest> interest)
+{}
+
+void
+ContactPanel::popChatInvitation(Ptr<ChronosInvitation> invitation,
+                                const Name& inviterNameSpace,
+                                Ptr<security::IdentityCertificate> certificate)
+{
+  string alias;
+  vector<Ptr<ContactItem> >::iterator it = m_contactList.begin();
+  for(; it != m_contactList.end(); it++)
+    if((*it)->getNameSpace() == inviterNameSpace)
+      alias = (*it)->getAlias();
+
+  if(it != m_contactList.end())
+    return;
+
+  m_invitationDialog->setInvitation(alias, invitation, certificate);
+  emit newInvitationReady();
+}
+
+void
+ContactPanel::collectEndorsement()
+{
+  m_collectStatus = Ptr<vector<bool> >::Create();
+  m_collectStatus->assign(m_contactList.size(), false);
+
+  vector<Ptr<ContactItem> >::iterator it = m_contactList.begin();
+  int count = 0;
+  for(; it != m_contactList.end(); it++, count++)
+    {
+      Name interestName = (*it)->getNameSpace();
+      interestName.append("DNS").append(m_defaultIdentity).append("ENDORSEE");
+      Ptr<Interest> interest = Ptr<Interest>(new Interest(interestName));
+      interest->setChildSelector(Interest::CHILD_RIGHT);
+      interest->setInterestLifetime(1);
+  
+      Ptr<Closure> closure = Ptr<Closure>(new Closure(boost::bind(&ContactPanel::onDnsEndorseeVerified, 
+                                                                  this,
+                                                                  _1,
+                                                                  count),
+                                                      boost::bind(&ContactPanel::onDnsEndorseeTimeout,
+                                                                  this,
+                                                                  _1, 
+                                                                  _2,
+                                                                  count),
+                                                      boost::bind(&ContactPanel::onDnsEndorseeUnverified,
+                                                                  this,
+                                                                  _1,
+                                                                  count)));
+
+      m_handler->sendInterest(interest, closure);
+    }
+}
+
+void
+ContactPanel::onDnsEndorseeVerified(Ptr<Data> data, int count)
+{
+  Ptr<Blob> contentBlob = Ptr<Blob>(new Blob(data->content().buf(), data->content().size()));
+  Ptr<Data> endorseData = Data::decodeFromWire(contentBlob);
+  EndorseCertificate endorseCertificate(*endorseData);
+
+  m_contactManager->getContactStorage()->updateCollectEndorse(endorseCertificate);
+
+  updateCollectStatus(count);
+}
+
+void
+ContactPanel::onDnsEndorseeTimeout(Ptr<Closure> closure, Ptr<Interest> interest, int count)
+{ updateCollectStatus(count); }
+
+void
+ContactPanel::onDnsEndorseeUnverified(Ptr<Data> data, int count)
+{ updateCollectStatus(count); }
+
+void 
+ContactPanel::updateCollectStatus(int count)
+{
+  m_collectStatus->at(count) = true;
+  vector<bool>::const_iterator it = m_collectStatus->begin();
+  for(; it != m_collectStatus->end(); it++)
+    if(*it == false)
+      return;
+
+  m_contactManager->publishEndorsedDataInDns(m_defaultIdentity);
+}
+
+static std::string chars("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789");
+
+string
+ContactPanel::getRandomString()
+{
+  string randStr;
+  boost::random::random_device rng;
+  boost::random::uniform_int_distribution<> index_dist(0, chars.size() - 1);
+  for (int i = 0; i < 10; i ++)
+  {
+    randStr += chars[index_dist(rng)];
+  }
+  return randStr;
+}
+
+void
 ContactPanel::updateSelection(const QItemSelection &selected,
 			      const QItemSelection &deselected)
 {
   QModelIndexList items = selected.indexes();
   QString text = m_contactListModel->data(items.first(), Qt::DisplayRole).toString();
-  string alias = text.toUtf8().constData();
+  string alias = text.toStdString();
 
   int i = 0;
   for(; i < m_contactList.size(); i++)
@@ -393,17 +410,13 @@
     }
   
   m_currentSelectedContact = m_contactList[i];
-  QString name = QString::fromUtf8(m_currentSelectedContact->getName().c_str());
-  QString institution = QString::fromUtf8(m_currentSelectedContact->getInstitution().c_str());
-  QString nameSpace = QString::fromUtf8(m_currentSelectedContact->getNameSpace().toUri().c_str());
+  QString name = QString::fromStdString(m_currentSelectedContact->getName());
+  QString institution = QString::fromStdString(m_currentSelectedContact->getInstitution());
+  QString nameSpace = QString::fromStdString(m_currentSelectedContact->getNameSpace().toUri());
   ui->NameData->setText(name);
   ui->NameSpaceData->setText(nameSpace);
   ui->InstitutionData->setText(institution);
 
-  // m_currentSelectedContactAlias = alias;
-  // m_currentSelectedContactNamespace = m_contactList[i]->getNameSpace().toUri();
-  // _LOG_DEBUG("current Alias: " << m_currentSelectedContact);
-
   if(m_currentSelectedContact->isIntroducer())
     {
       ui->isIntroducer->setChecked(true);
@@ -422,8 +435,6 @@
       m_trustScopeModel->setHeaderData(1, Qt::Horizontal, QObject::tr("Contact"));
       m_trustScopeModel->setHeaderData(2, Qt::Horizontal, QObject::tr("TrustScope"));
 
-      // _LOG_DEBUG("row count: " << m_trustScopeModel->rowCount());
-
       ui->trustScopeList->setModel(m_trustScopeModel);
       ui->trustScopeList->setColumnHidden(0, true);
       ui->trustScopeList->setColumnHidden(1, true);
@@ -473,25 +484,15 @@
   ui->endorseList->resizeColumnToContents(2);
   ui->endorseList->setItemDelegateForColumn(3, m_endorseComboBoxDelegate);
   ui->endorseList->show();
-
 }
 
 void
-ContactPanel::updateDefaultIdentity(const QString& identity)
+ContactPanel::updateDefaultIdentity(const QString& identity, const QString& nickName)
 { 
-  m_defaultIdentity = Name(identity.toUtf8().constData()); 
-  Name prefix("/ndn/broadcast/chronos/invitation");
-  prefix.append(m_defaultIdentity);
-
-  _LOG_DEBUG("reset invite listen prefix: " << prefix.toUri());
-  
+  m_defaultIdentity = Name(identity.toStdString());
+  m_nickName = nickName.toStdString();
   m_handler->clearInterestFilter(m_inviteListenPrefix);
-  m_handler->setInterestFilter(prefix,
-                               boost::bind(&ContactPanel::onInvitation, 
-                                           this,
-                                           _1));
-  m_inviteListenPrefix = prefix;
-
+  setInvitationListener();
   collectEndorsement();
 }
 
@@ -542,7 +543,7 @@
 void
 ContactPanel::openSettingDialog()
 {
-  m_settingDialog->setIdentity(m_defaultIdentity.toUri());
+  m_settingDialog->setIdentity(m_defaultIdentity.toUri(), m_nickName);
   m_settingDialog->show();
 }
 
@@ -569,10 +570,14 @@
   _LOG_DEBUG("introducer: " << std::boolalpha << isIntroducer);
 
   Name chatroomName(chatroom.toUtf8().constData());
-  
-  ChatDialog* chatDialog = new ChatDialog(m_contactManager, chatroomName, m_localPrefix, m_defaultIdentity);
+  Name prefix = m_localPrefix.getPrefix(m_localPrefix.size()-1);
+  ChatDialog* chatDialog = new ChatDialog(m_contactManager, chatroomName, prefix, m_defaultIdentity, m_nickName);
+  // ChatDialog* chatDialog = new ChatDialog(m_contactManager, chatroomName, m_localPrefix, m_defaultIdentity);
   m_chatDialogs.insert(pair <Name, ChatDialog*> (chatroomName, chatDialog));
-  
+
+  connect(chatDialog, SIGNAL(closeChatDialog(const ndn::Name&)),
+          this, SLOT(removeChatDialog(const ndn::Name&)));
+
   //TODO: send invitation
   Name inviteeNamespace(invitee.toUtf8().constData());
   Ptr<ContactItem> inviteeItem = m_contactManager->getContact(inviteeNamespace);
@@ -592,15 +597,23 @@
 
   Name chatroomName("/ndn/broadcast/chronos");
   chatroomName.append(invitation.getChatroom());
+  Name prefix = m_localPrefix.getPrefix(m_localPrefix.size()-1);
+  ChatDialog* chatDialog = new ChatDialog(m_contactManager, chatroomName, prefix, m_defaultIdentity, m_nickName, true);
+  // ChatDialog* chatDialog = new ChatDialog(m_contactManager, chatroomName, m_localPrefix, m_defaultIdentity);
+  connect(chatDialog, SIGNAL(closeChatDialog(const ndn::Name&)),
+          this, SLOT(removeChatDialog(const ndn::Name&)));
 
-  ChatDialog* chatDialog = new ChatDialog(m_contactManager, chatroomName, m_localPrefix, m_defaultIdentity);
-  chatDialog->addChatDataRule(invitation.getInviterPrefix(), identityCertificate, true);
+  Name inviterPrefix = invitation.getInviterPrefix().getPrefix(invitation.getInviterPrefix().size()-1);
+  chatDialog->addChatDataRule(inviterPrefix, identityCertificate, true);
+  // chatDialog->addChatDataRule(invitation.getInviterPrefix(), identityCertificate, true);
 
   Ptr<ContactItem> inviterItem = m_contactManager->getContact(invitation.getInviterNameSpace());
   chatDialog->addTrustAnchor(inviterItem->getSelfEndorseCertificate());
   
   m_chatDialogs.insert(pair <Name, ChatDialog*> (chatroomName, chatDialog));
 
+
+
   chatDialog->show();
 }
 
@@ -719,6 +732,21 @@
   m_contactManager->updateEndorseCertificate(m_currentSelectedContact->getNameSpace(), m_defaultIdentity);
 }
 
+void
+ContactPanel::removeChatDialog(const ndn::Name& chatroomName)
+{
+  map<Name, ChatDialog*>::iterator it = m_chatDialogs.find(chatroomName);
+  _LOG_DEBUG("about to leave 2!");
+  ChatDialog* deletedChat;
+  if(it != m_chatDialogs.end())
+    {
+      _LOG_DEBUG("about to leave 3!");
+      deletedChat = it->second;
+      m_chatDialogs.erase(it);      
+    }
+  delete deletedChat;
+}
+
 #if WAF
 #include "contactpanel.moc"
 #include "contactpanel.cpp.moc"
diff --git a/src/contactpanel.h b/src/contactpanel.h
index 222bf0b..fd76b0b 100644
--- a/src/contactpanel.h
+++ b/src/contactpanel.h
@@ -41,12 +41,16 @@
   Q_OBJECT
 
 public:
-  explicit ContactPanel(ndn::Ptr<ContactManager> contactManager, QWidget *parent = 0);
+  explicit ContactPanel(ndn::Ptr<ContactManager> contactManager, 
+                        QWidget *parent = 0);
 
   ~ContactPanel();
 
 private:
   void
+  createAction();
+
+  void
   openDB();
 
   void
@@ -59,37 +63,44 @@
   onLocalPrefixVerified(ndn::Ptr<ndn::Data> data);
   
   void
-  onLocalPrefixTimeout(ndn::Ptr<ndn::Closure> closure, ndn::Ptr<ndn::Interest> interest);
+  onLocalPrefixTimeout(ndn::Ptr<ndn::Closure> closure, 
+                       ndn::Ptr<ndn::Interest> interest);
 
   void
-  onUnverified(ndn::Ptr<ndn::Data> data);
-  
-  void
-  onTimeout(ndn::Ptr<ndn::Closure> closure, ndn::Ptr<ndn::Interest> interest);
-    
-  void
   setInvitationListener();
 
   void
   onInvitation(ndn::Ptr<ndn::Interest> interest);
 
   void
+  onUnverified(ndn::Ptr<ndn::Data> data);
+  
+  void
+  onTimeout(ndn::Ptr<ndn::Closure> closure, 
+            ndn::Ptr<ndn::Interest> interest);
+    
+  void
   onInvitationCertVerified(ndn::Ptr<ndn::Data> data,
                            ndn::Ptr<ChronosInvitation> invitation);
 
   void
+  popChatInvitation(ndn::Ptr<ChronosInvitation> invitation,
+                    const ndn::Name& inviterNameSpace,
+                    ndn::Ptr<ndn::security::IdentityCertificate> certificate);
+
+  void
   collectEndorsement();
 
   void
-  onDnsEndoreeVerified(ndn::Ptr<ndn::Data> data, int count);
+  onDnsEndorseeVerified(ndn::Ptr<ndn::Data> data, int count);
 
   void
-  onDnsEndoreeTimeout(ndn::Ptr<ndn::Closure> closure, 
+  onDnsEndorseeTimeout(ndn::Ptr<ndn::Closure> closure, 
                       ndn::Ptr<ndn::Interest> interest, 
                       int count);
   
   void
-  onDnsEndoreeUnverified(ndn::Ptr<ndn::Data> data, int count);
+  onDnsEndorseeUnverified(ndn::Ptr<ndn::Data> data, int count);
 
   void 
   updateCollectStatus(int count);
@@ -97,11 +108,6 @@
   std::string
   getRandomString();
 
-  void
-  popChatInvitation(ndn::Ptr<ChronosInvitation> invitation,
-                    const ndn::Name& inviterNameSpace,
-                    ndn::Ptr<ndn::security::IdentityCertificate> certificate);
-
 signals:
   void
   newInvitationReady();
@@ -112,7 +118,8 @@
                   const QItemSelection &deselected);
 
   void
-  updateDefaultIdentity(const QString& identity);
+  updateDefaultIdentity(const QString& identity,
+                        const QString& nickName);
 
   void
   openProfileEditor();
@@ -139,7 +146,9 @@
   showContextMenu(const QPoint& pos);
 
   void
-  startChatroom(const QString& chatroom, const QString& invitee, bool isIntroducer);
+  startChatroom(const QString& chatroom, 
+                const QString& invitee, 
+                bool isIntroducer);
 
   void 
   startChatroom2(const ChronosInvitation& invitation, 
@@ -166,6 +175,9 @@
 
   void
   endorseButtonClicked();
+  
+  void
+  removeChatDialog(const ndn::Name& chatroomName);
 
   
 
@@ -190,17 +202,14 @@
   ndn::Ptr<ndn::Wrapper> m_handler;
 
   ndn::Name m_defaultIdentity;
+  std::string m_nickName;
   ndn::Name m_localPrefix;
   ndn::Name m_inviteListenPrefix;
 
-  // std::string m_currentSelectedContactAlias;
-  // std::string m_currentSelectedContactNamespace;
   ndn::Ptr<ContactItem> m_currentSelectedContact;
   QSqlTableModel* m_trustScopeModel;
   QSqlTableModel* m_endorseDataModel;
   EndorseComboBoxDelegate* m_endorseComboBoxDelegate;
-
-
 };
 
 #endif // CONTACTPANEL_H
diff --git a/src/main.cpp b/src/main.cpp
index 0ae3da1..4e58e77 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -16,10 +16,13 @@
 #include "contact-storage.h"
 #include "dns-storage.h"
 #include "contact-manager.h"
+#include "logging.h"
 #include <ndn.cxx/security/identity/identity-manager.h>
 #include <ndn.cxx/security/identity/osx-privatekey-storage.h>
 #include <ndn.cxx/security/identity/basic-identity-storage.h>
 
+INIT_LOGGER("MAIN");
+
 using namespace ndn;
 
 class NewApp : public QApplication
@@ -27,7 +30,7 @@
 public:
   NewApp(int & argc, char ** argv)
     : QApplication(argc, argv)
-  {}
+  { }
 
   bool notify(QObject * receiver, QEvent * event) 
   {
@@ -48,14 +51,10 @@
 {
   NewApp app(argc, argv);
 
+  // app.setWindowIcon(QIcon(":/demo.icns"));
 
-//   app.setWindowIcon(QIcon("/Users/yuyingdi/Develop/QT/demo.icns"));
-// // #else
-// // 	app.setWindowIcon(QIcon("/Users/yuyingdi/Develop/QT/images/icon_large.png"));
-// // #endif
-
-  Ptr<ContactStorage> contactStorage = Ptr<ContactStorage>(new ContactStorage());
-  Ptr<DnsStorage> dnsStorage = Ptr<DnsStorage>(new DnsStorage());
+  Ptr<ContactStorage> contactStorage = Ptr<ContactStorage>::Create();
+  Ptr<DnsStorage> dnsStorage = Ptr<DnsStorage>::Create();
   Ptr<ContactManager> contactManager = Ptr<ContactManager>(new ContactManager(contactStorage, dnsStorage));
 
   ContactPanel contactPanel(contactManager);
diff --git a/src/settingdialog.cpp b/src/settingdialog.cpp
index a8dca16..ed9a1bd 100644
--- a/src/settingdialog.cpp
+++ b/src/settingdialog.cpp
@@ -29,21 +29,28 @@
 }
 
 void
-SettingDialog::setIdentity(const std::string& identity)
+SettingDialog::setIdentity(const std::string& identity,
+                           const std::string& nickName)
 { 
   m_identity = identity;
-  ui->identityLine->setText(QString::fromUtf8(m_identity.c_str()));
+  ui->identityLine->setText(QString::fromStdString(m_identity));
+  m_nickName = nickName;
+  ui->nickLine->setText(QString::fromStdString(m_nickName));
 }
 
 void
 SettingDialog::onOkClicked()
 {
-  QString text = ui->identityLine->text();
-  string identity = text.toUtf8().constData();
-  if(identity != m_identity)
+  QString qIdentity = ui->identityLine->text();
+  string identity = qIdentity.toStdString();
+  QString qNick = ui->nickLine->text();
+  string nick = qNick.toStdString();
+
+  if(identity != m_identity || nick != m_nickName)
     {
       m_identity = identity;
-      emit identitySet(text);
+      m_nickName = nick;
+      emit identitySet(qIdentity, qNick);
     }
   this->close();
 }
diff --git a/src/settingdialog.h b/src/settingdialog.h
index a06046d..9ee6865 100644
--- a/src/settingdialog.h
+++ b/src/settingdialog.h
@@ -26,11 +26,13 @@
   ~SettingDialog();
 
   void
-  setIdentity(const std::string& identity);
+  setIdentity(const std::string& identity,
+              const std::string& nickName);
 
 signals:
   void
-  identitySet(const QString& identity);
+  identitySet(const QString& identity,
+              const QString& nickName);
 
 private slots:
   void
@@ -39,6 +41,7 @@
 private:
   Ui::SettingDialog *ui;
   std::string m_identity;
+  std::string m_nickName;
 };
 
 #endif // SETTINGDIALOG_H
diff --git a/src/settingdialog.ui b/src/settingdialog.ui
index 5d3c04d..271ef23 100644
--- a/src/settingdialog.ui
+++ b/src/settingdialog.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>300</width>
-    <height>140</height>
+    <height>150</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -17,7 +17,7 @@
    <property name="geometry">
     <rect>
      <x>100</x>
-     <y>90</y>
+     <y>110</y>
      <width>100</width>
      <height>32</height>
     </rect>
@@ -29,8 +29,8 @@
   <widget class="QLabel" name="msgLabel">
    <property name="geometry">
     <rect>
-     <x>20</x>
-     <y>20</y>
+     <x>10</x>
+     <y>10</y>
      <width>150</width>
      <height>16</height>
     </rect>
@@ -48,9 +48,38 @@
   <widget class="QLineEdit" name="identityLine">
    <property name="geometry">
     <rect>
-     <x>20</x>
-     <y>50</y>
-     <width>260</width>
+     <x>10</x>
+     <y>30</y>
+     <width>280</width>
+     <height>21</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="nickLabel">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>60</y>
+     <width>150</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="font">
+    <font>
+     <weight>75</weight>
+     <bold>true</bold>
+    </font>
+   </property>
+   <property name="text">
+    <string>Nick Name:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="nickLine">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>80</y>
+     <width>280</width>
      <height>21</height>
     </rect>
    </property>
