diff --git a/src/communication/nlsr_dm.cpp b/src/communication/nlsr_dm.cpp
index e425767..ffb85e3 100644
--- a/src/communication/nlsr_dm.cpp
+++ b/src/communication/nlsr_dm.cpp
@@ -191,21 +191,26 @@
   void
   DataManager::processContentKeys(Nlsr& pnlsr, const ndn::Data& data)
   {
-    cout<<" processContentKeys called "<<endl;
+    std::cout<<" processContentKeys called "<<endl;
     ndn::shared_ptr<ndn::IdentityCertificate> cert=
       ndn::make_shared<ndn::IdentityCertificate>();
     cert->wireDecode(data.getContent().blockFromValue());
-    cout<<*(cert)<<endl;
+    std::cout<<*(cert)<<endl;
     std::string dataName=data.getName().toUri();
     nlsrTokenizer nt(dataName,"/");
     std::string certName=nt.getTokenString(0,nt.getTokenNumber()-3);
     uint32_t seqNum=boost::lexical_cast<uint32_t>(nt.getToken(
                       nt.getTokenNumber()-2));
     cout<<"Cert Name: "<<certName<<" Seq Num: "<<seqNum<<std::endl;
-    if ( pnlsr.getKeyManager().verify(*(cert)))
+    if ( pnlsr.getKeyManager().verify(pnlsr, *(cert)))
     {
       pnlsr.getKeyManager().addCertificate(cert, seqNum, true);
-      //pnlsr.getKeyManager().printCertStore();
     }
+    else
+    {
+      pnlsr.getKeyManager().addCertificate(cert, seqNum, false);
+    }
+    
+    pnlsr.getKeyManager().printCertStore();
   }
 }//namespace nlsr
diff --git a/src/communication/nlsr_im.cpp b/src/communication/nlsr_im.cpp
index b22b445..16d0c72 100644
--- a/src/communication/nlsr_im.cpp
+++ b/src/communication/nlsr_im.cpp
@@ -43,12 +43,6 @@
     {
       processInterestKeys(pnlsr,interest);
     }
-    //Data data(ndn::Name(interest->getName()).append("testApp").appendVersion());
-    //data.setFreshnessPeriod(1000); // 10 sec
-    //data.setContent((const uint8_t*)"HELLO KITTY", sizeof("HELLO KITTY"));
-    //pnlsr.getKeyChain().sign(data);
-    //cout << ">> D: " << data << endl;
-    //pnlsr.getNlsrFace().put(data);
   }
 
   void
@@ -190,31 +184,54 @@
     string intName=interest.getName().toUri();
     cout<<"Interest Name for Key: "<<intName<<std::endl;
     nlsrTokenizer nt(intName,"/");
-    std::string certName=nt.getTokenString(0,nt.getTokenNumber()-2);
-    uint32_t seqNum=boost::lexical_cast<uint32_t>(nt.getToken(
-                      nt.getTokenNumber()-1));
-    cout<<"Cert Name: "<<certName<<" Seq Num: "<<seqNum<<std::endl;
-    std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> chkCert=
-      pnlsr.getKeyManager().getCertificateFromStore(certName,seqNum);
+    std::string chkString("ID-CERT");
+    std::string certName;
+    uint32_t seqNum;
+    ndn::Name dataName;
+    std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> chkCert;
+    if( nt.getTokenPosition(chkString) == nt.getTokenNumber()-1 )
+    {
+      certName=nt.getTokenString(0,nt.getTokenNumber()-1);
+      cout<<"Cert Name: "<<certName<<std::endl;
+      chkCert=pnlsr.getKeyManager().getCertificateFromStore(certName);
+    }
+    else
+    {
+      certName=nt.getTokenString(0,nt.getTokenNumber()-2);
+      seqNum=boost::lexical_cast<uint32_t>(nt.getToken(nt.getTokenNumber()-1));
+      cout<<"Cert Name: "<<certName<<" Seq Num: "<<seqNum<<std::endl;
+      chkCert=pnlsr.getKeyManager().getCertificateFromStore(certName,seqNum);
+    }
     if( chkCert.second )
     {
-      Data data(ndn::Name(interest.getName()).appendVersion());
+      if(nt.getTokenPosition(chkString) == nt.getTokenNumber()-1)
+      {
+        std::string dn;
+        dataName=ndn::Name(interest.getName()).appendVersion();
+        std::pair<uint32_t, bool> seqChk = 
+                           pnlsr.getKeyManager().getCertificateSeqNum(certName);
+        if( seqChk.second )
+        {
+          dn=dataName.toUri()+"/"+boost::lexical_cast<std::string>(seqChk.first);
+          dataName=ndn::Name(dn);
+        }
+        else
+        {
+          dn=dataName.toUri()+"/"+boost::lexical_cast<std::string>(10);
+          dataName=ndn::Name(dn);
+        }
+        
+      }
+      else
+      {
+        dataName=ndn::Name(interest.getName());
+      }
+      Data data(dataName.appendVersion());
       data.setFreshnessPeriod(1000); //10 sec
       data.setContent(chkCert.first->wireEncode());
       pnlsr.getKeyManager().signData(data);
       pnlsr.getNlsrFace()->put(data);
     }
-    //std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> chkCert=
-    /*
-    ndn::shared_ptr<ndn::IdentityCertificate> cert=pnlsr.getKeyManager().getCertificate();
-    Data data(ndn::Name(interest.getName()).appendVersion());
-    data.setFreshnessPeriod(1000); // 10 sec
-    data.setContent(cert->wireEncode());
-    pnlsr.getKeyManager().signData(data);
-    //std::ofstream outFile("data_sent");
-    //ndn::io::save(data,outFile,ndn::io::NO_ENCODING);
-    pnlsr.getNlsrFace()->put(data);
-    */
   }
 
 
diff --git a/src/communication/nlsr_slh.cpp b/src/communication/nlsr_slh.cpp
index 098610d..189612a 100644
--- a/src/communication/nlsr_slh.cpp
+++ b/src/communication/nlsr_slh.cpp
@@ -130,10 +130,10 @@
   void
   SyncLogicHandler::publishKeyUpdate(KeyManager& km)
   {
-    publishSyncUpdate(km.getRootCertName().toUri(), 10);
-    publishSyncUpdate(km.getSiteCertName().toUri(), 10);
-    publishSyncUpdate(km.getOperatorCertName().toUri(), 10);
-    publishSyncUpdate(km.getRouterCertName().toUri(), km.getCertSeqNo());
+    //publishSyncUpdate(km.getRootCertName().toUri(), 10);
+    //publishSyncUpdate(km.getSiteCertName().toUri(), 10);
+    //publishSyncUpdate(km.getOperatorCertName().toUri(), 10);
+    //publishSyncUpdate(km.getRouterCertName().toUri(), km.getCertSeqNo());
     publishSyncUpdate(km.getProcessCertName().toUri(),km.getCertSeqNo());
   }
 
