refactor: cleanup and sync

* Fix Jenkins scripts and sync with ndn-cxx
* Sync waf-tools
* Remove ChronoSync submodule
* Remove commented/dead code and includes
* Use ScopedEventId and ScopedRegisteredPrefixHandle
* Set setCanBePrefix to true explicitly everywhere
* Fix macOS build, add GHA CI
* Use NDN_THROW for throwing errors
* Other smaller fixes

Change-Id: I615e0e239511b97101852e1d7c620a2071a18ff8
diff --git a/src/add-contact-panel.cpp b/src/add-contact-panel.cpp
index 770f039..48e59d6 100644
--- a/src/add-contact-panel.cpp
+++ b/src/add-contact-panel.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -11,9 +11,6 @@
 #include "add-contact-panel.hpp"
 #include "ui_add-contact-panel.h"
 
-#ifndef Q_MOC_RUN
-#endif
-
 namespace chronochat {
 
 AddContactPanel::AddContactPanel(QWidget *parent)
@@ -98,5 +95,4 @@
 
 #if WAF
 #include "add-contact-panel.moc"
-// #include "add-contact-panel.cpp.moc"
 #endif
diff --git a/src/add-contact-panel.hpp b/src/add-contact-panel.hpp
index fe8f851..0c73fa7 100644
--- a/src/add-contact-panel.hpp
+++ b/src/add-contact-panel.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -20,7 +20,7 @@
 
 namespace Ui {
 class AddContactPanel;
-}
+} // namespace Ui
 
 namespace chronochat {
 
diff --git a/src/browse-contact-dialog.cpp b/src/browse-contact-dialog.cpp
index bf9df24..887c664 100644
--- a/src/browse-contact-dialog.cpp
+++ b/src/browse-contact-dialog.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -135,5 +135,4 @@
 
 #if WAF
 #include "browse-contact-dialog.moc"
-// #include "browse-contact-dialog.cpp.moc"
 #endif
diff --git a/src/browse-contact-dialog.hpp b/src/browse-contact-dialog.hpp
index 4a081e0..f80f684 100644
--- a/src/browse-contact-dialog.hpp
+++ b/src/browse-contact-dialog.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -24,7 +24,7 @@
 
 namespace Ui {
 class BrowseContactDialog;
-}
+} // namespace Ui
 
 namespace chronochat {
 
@@ -61,7 +61,7 @@
   onNameListReady(const QStringList& nameList);
 
   void
-  onIdCertReady(const ndn::security::Certificate & idCert);
+  onIdCertReady(const ndn::security::Certificate& idCert);
 
 signals:
   void
diff --git a/src/chat-dialog-backend.cpp b/src/chat-dialog-backend.cpp
index 234e4a3..53bfdb3 100644
--- a/src/chat-dialog-backend.cpp
+++ b/src/chat-dialog-backend.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013-2016, Regents of the University of California
+ * Copyright (c) 2013-2020, Regents of the University of California
  *                          Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -68,7 +68,7 @@
     try {
       m_face->getIoService().run();
     }
-    catch (std::runtime_error& e) {
+    catch (const std::runtime_error& e) {
       {
         std::lock_guard<std::mutex>lock(m_nfdConnectionMutex);
         m_isNfdConnected = false;
@@ -131,10 +131,8 @@
                         bind(&ChatDialogBackend::sendJoin, this));
 
   // cancel existing hello event if it exists
-  if (m_helloEventId) {
+  if (m_helloEventId)
     m_helloEventId.cancel();
-    m_helloEventId.reset();
-  }
 }
 
 class IoDeviceSource
@@ -229,7 +227,7 @@
   try {
     msg.wireDecode(data.getContent().blockFromValue());
   }
-  catch (tlv::Error&) {
+  catch (const tlv::Error&) {
     // nasty stuff: as a remedy, we'll form some standard msg for inparsable msgs
     msg.setNick("inconnu");
     msg.setMsgType(ChatMessage::OTHER);
@@ -243,7 +241,7 @@
 
     if (it != m_roster.end()) {
       // cancel timeout event
-      if (static_cast<bool>(it->second.timeoutEventId))
+      if (it->second.timeoutEventId)
         it->second.timeoutEventId.cancel();
 
       // notify frontend to remove the remote session (node)
@@ -268,10 +266,6 @@
 
     uint64_t seqNo = data.getName().get(-1).toNumber();
 
-    // If a timeout event has been scheduled, cancel it.
-    if (static_cast<bool>(it->second.timeoutEventId))
-      it->second.timeoutEventId.cancel();
-
     // (Re)schedule another timeout event after 3 HELLO_INTERVAL;
     it->second.timeoutEventId =
       m_scheduler->schedule(HELLO_INTERVAL * 3,
@@ -414,7 +408,7 @@
 void
 ChatDialogBackend::prepareChatMessage(const QString& text,
                                       time_t timestamp,
-                                      ChatMessage &msg)
+                                      ChatMessage& msg)
 {
   msg.setNick(m_nick);
   msg.setChatroomName(m_chatroomName);
@@ -514,5 +508,4 @@
 
 #if WAF
 #include "chat-dialog-backend.moc"
-// #include "chat-dialog-backend.cpp.moc"
 #endif
diff --git a/src/chat-dialog-backend.hpp b/src/chat-dialog-backend.hpp
index e9543bb..0c417c3 100644
--- a/src/chat-dialog-backend.hpp
+++ b/src/chat-dialog-backend.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -25,18 +25,20 @@
 
 namespace chronochat {
 
-class NodeInfo {
+class NodeInfo
+{
 public:
   QString sessionPrefix;
   chronosync::SeqNo seqNo;
 };
 
-class UserInfo {
+class UserInfo
+{
 public:
   ndn::Name sessionPrefix;
   bool hasNick;
   std::string userNick;
-  ndn::scheduler::EventId timeoutEventId;
+  ndn::scheduler::ScopedEventId timeoutEventId;
 };
 
 class ChatDialogBackend : public QThread
@@ -98,7 +100,7 @@
   void
   prepareChatMessage(const QString& text,
                      time_t timestamp,
-                     ChatMessage &msg);
+                     ChatMessage& msg);
 
   void
   updatePrefixes();
diff --git a/src/chat-dialog.cpp b/src/chat-dialog.cpp
index 0158496..2d93156 100644
--- a/src/chat-dialog.cpp
+++ b/src/chat-dialog.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -150,7 +150,7 @@
 void
 ChatDialog::changeEvent(QEvent *e)
 {
-  switch(e->type()) {
+  switch (e->type()) {
   case QEvent::ActivationChange:
     if (isActiveWindow()) {
       emit resetIcon();
@@ -450,5 +450,4 @@
 
 #if WAF
 #include "chat-dialog.moc"
-// #include "chat-dialog.cpp.moc"
 #endif
diff --git a/src/chat-dialog.hpp b/src/chat-dialog.hpp
index 6510297..5b9a14f 100644
--- a/src/chat-dialog.hpp
+++ b/src/chat-dialog.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -32,7 +32,7 @@
 
 namespace Ui {
 class ChatDialog;
-}
+} // namespace Ui
 
 namespace chronochat {
 
diff --git a/src/chat-message.cpp b/src/chat-message.cpp
index 7932321..9a78f9d 100644
--- a/src/chat-message.cpp
+++ b/src/chat-message.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -101,23 +101,23 @@
   m_wire.parse();
 
   if (m_wire.type() != tlv::ChatMessage)
-    throw Error("Unexpected TLV number when decoding chat message packet");
+    NDN_THROW(Error("Unexpected TLV number when decoding chat message packet"));
 
   Block::element_const_iterator i = m_wire.elements_begin();
   if (i == m_wire.elements_end() || i->type() != tlv::Nick)
-    throw Error("Expect Nick but get ...");
+    NDN_THROW(Error("Expect Nick but get ..."));
   m_nick = std::string(reinterpret_cast<const char* >(i->value()),
                        i->value_size());;
   i++;
 
   if (i == m_wire.elements_end() || i->type() != tlv::ChatroomName)
-    throw Error("Expect Chatroom Name but get ...");
+    NDN_THROW(Error("Expect Chatroom Name but get ..."));
   m_chatroomName = std::string(reinterpret_cast<const char* >(i->value()),
                        i->value_size());;
   i++;
 
   if (i == m_wire.elements_end() || i->type() != tlv::ChatMessageType)
-    throw Error("Expect Chat Message Type but get ...");
+    NDN_THROW(Error("Expect Chat Message Type but get ..."));
   m_msgType = static_cast<ChatMessageType>(readNonNegativeInteger(*i));
   i++;
 
@@ -125,19 +125,19 @@
     m_data = "";
   else {
     if (i == m_wire.elements_end() || i->type() != tlv::ChatData)
-      throw Error("Expect Chat Data but get ...");
+      NDN_THROW(Error("Expect Chat Data but get ..."));
     m_data = std::string(reinterpret_cast<const char* >(i->value()),
                        i->value_size());;
     i++;
   }
 
   if (i == m_wire.elements_end() || i->type() != tlv::Timestamp)
-    throw Error("Expect Timestamp but get ...");
+    NDN_THROW(Error("Expect Timestamp but get ..."));
   m_timestamp = static_cast<time_t>(readNonNegativeInteger(*i));
   i++;
 
   if (i != m_wire.elements_end()) {
-    throw Error("Unexpected element");
+    NDN_THROW(Error("Unexpected element"));
   }
 
 }
@@ -177,4 +177,4 @@
   m_timestamp = timestamp;
 }
 
-}// namespace chronochat
+} // namespace chronochat
diff --git a/src/chat-message.hpp b/src/chat-message.hpp
index 778f505..1a44005 100644
--- a/src/chat-message.hpp
+++ b/src/chat-message.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -61,13 +61,13 @@
   const std::string&
   getChatroomName() const;
 
-  const ChatMessageType
+  ChatMessageType
   getMsgType() const;
 
   const std::string&
   getData() const;
 
-  const time_t
+  time_t
   getTimestamp() const;
 
   void
@@ -112,7 +112,7 @@
   return m_chatroomName;
 }
 
-inline const ChatMessage::ChatMessageType
+inline ChatMessage::ChatMessageType
 ChatMessage::getMsgType() const
 {
   return m_msgType;
@@ -124,7 +124,7 @@
   return m_data;
 }
 
-inline const time_t
+inline time_t
 ChatMessage::getTimestamp() const
 {
   return m_timestamp;
@@ -132,4 +132,4 @@
 
 } // namespace chronochat
 
-#endif //CHRONOCHAT_CHAT_MESSAGE_HPP
+#endif // CHRONOCHAT_CHAT_MESSAGE_HPP
diff --git a/src/chatroom-discovery-backend.cpp b/src/chatroom-discovery-backend.cpp
index 67dd7fa..3f92e01 100644
--- a/src/chatroom-discovery-backend.cpp
+++ b/src/chatroom-discovery-backend.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -11,7 +11,6 @@
 #include "chatroom-discovery-backend.hpp"
 #include <QStringList>
 
-
 #ifndef Q_MOC_RUN
 
 #endif
@@ -63,7 +62,7 @@
     try {
       m_face->getIoService().run();
     }
-    catch (std::runtime_error& e) {
+    catch (const std::runtime_error& e) {
       {
         std::lock_guard<std::mutex>lock(m_nfdConnectionMutex);
         m_isNfdConnected = false;
@@ -113,9 +112,6 @@
                                                 this, _1));
 
   // add an timer to refresh front end
-  if (m_refreshPanelId) {
-    m_refreshPanelId.cancel();
-  }
   m_refreshPanelId = m_scheduler->schedule(REFRESH_INTERVAL,
                                            [this] { sendChatroomList(); });
 }
@@ -124,7 +120,6 @@
 ChatroomDiscoveryBackend::close()
 {
   m_scheduler->cancelAllEvents();
-  m_refreshPanelId.reset();
   m_chatroomList.clear();
   m_sock.reset();
 }
@@ -169,9 +164,9 @@
         return;
       }
       else {
-        if (it->second.helloTimeoutEventId) {
+        if (it->second.helloTimeoutEventId)
           it->second.helloTimeoutEventId.cancel();
-        }
+
         it->second.isManager = false;
       }
 
@@ -250,10 +245,6 @@
   if (it != m_chatroomList.end() && it->second.isManager) {
     ndn::Block buf = it->second.info.wireEncode();
 
-    if (it->second.helloTimeoutEventId) {
-      it->second.helloTimeoutEventId.cancel();
-    }
-
     m_sock->publishData(buf.wire(), buf.size(), FRESHNESS_PERIOD, it->second.chatroomPrefix);
 
     it->second.helloTimeoutEventId =
@@ -431,9 +422,6 @@
   }
 
   emit chatroomListReady(chatroomList);
-  if (m_refreshPanelId) {
-    m_refreshPanelId.cancel();
-  }
   m_refreshPanelId = m_scheduler->schedule(REFRESH_INTERVAL,
                                            [this] { sendChatroomList(); });
 }
diff --git a/src/chatroom-discovery-backend.hpp b/src/chatroom-discovery-backend.hpp
index ad471ac..0c40ee4 100644
--- a/src/chatroom-discovery-backend.hpp
+++ b/src/chatroom-discovery-backend.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -24,7 +24,8 @@
 
 namespace chronochat {
 
-class ChatroomInfoBackend {
+class ChatroomInfoBackend
+{
 public:
   std::string chatroomName;
   Name chatroomPrefix;
@@ -36,7 +37,7 @@
   // For a user to check the status of the chatroom that he is not in.
   ndn::scheduler::EventId remoteChatroomTimeoutEventId;
   // If the user is manager, he will need the helloEventId to keep track of hello message
-  ndn::scheduler::EventId helloTimeoutEventId;
+  ndn::scheduler::ScopedEventId helloTimeoutEventId;
   // To tell whether the user is in this chatroom
   bool isParticipant;
   // To tell whether the user is the manager
@@ -228,7 +229,7 @@
   shared_ptr<ndn::Face> m_face;
 
   unique_ptr<ndn::Scheduler> m_scheduler;            // scheduler
-  ndn::scheduler::EventId m_refreshPanelId;
+  ndn::scheduler::ScopedEventId m_refreshPanelId;
   shared_ptr<chronosync::Socket> m_sock; // SyncSocket
 
   ChatroomList m_chatroomList;
diff --git a/src/chatroom-info.cpp b/src/chatroom-info.cpp
index aa8efcc..e8d47eb 100644
--- a/src/chatroom-info.cpp
+++ b/src/chatroom-info.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -137,47 +137,47 @@
   //                   Name+
 
   if (m_wire.type() != tlv::ChatroomInfo)
-    throw Error("Unexpected TLV number when decoding chatroom packet");
+    NDN_THROW(Error("Unexpected TLV number when decoding chatroom packet"));
 
   // Chatroom Info
   Block::element_const_iterator i = m_wire.elements_begin();
   if (i == m_wire.elements_end())
-    throw Error("Missing Chatroom Name");
+    NDN_THROW(Error("Missing Chatroom Name"));
   if (i->type() != tlv::ChatroomName)
-    throw Error("Expect Chatroom Name but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Chatroom Name but get TLV Type " + std::to_string(i->type())));
   m_chatroomName.wireDecode(i->blockFromValue());
   ++i;
 
   // Trust Model
   if (i == m_wire.elements_end())
-    throw Error("Missing Trust Model");
+    NDN_THROW(Error("Missing Trust Model"));
   if (i->type() != tlv::TrustModel)
-    throw Error("Expect Trust Model but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Trust Model but get TLV Type " + std::to_string(i->type())));
   m_trustModel =
       static_cast<TrustModel>(readNonNegativeInteger(*i));
   ++i;
 
   // Chatroom Sync Prefix
   if (i == m_wire.elements_end())
-    throw Error("Missing Chatroom Prefix");
+    NDN_THROW(Error("Missing Chatroom Prefix"));
   if (i->type() != tlv::ChatroomPrefix)
-    throw Error("Expect Chatroom Prefix but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Chatroom Prefix but get TLV Type " + std::to_string(i->type())));
   m_syncPrefix.wireDecode(i->blockFromValue());
   ++i;
 
   // Manager Prefix
   if (i == m_wire.elements_end())
-    throw Error("Missing Manager Prefix");
+    NDN_THROW(Error("Missing Manager Prefix"));
   if (i->type() != tlv::ManagerPrefix)
-    throw Error("Expect Manager Prefix but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Manager Prefix but get TLV Type " + std::to_string(i->type())));
   m_manager.wireDecode(i->blockFromValue());
   ++i;
 
   // Participants
   if (i == m_wire.elements_end())
-    throw Error("Missing Participant");
+    NDN_THROW(Error("Missing Participant"));
   if (i->type() != tlv::Participants)
-    throw Error("Expect Participant but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Participant but get TLV Type " + std::to_string(i->type())));
 
   Block temp = *i;
   temp.parse();
@@ -189,15 +189,15 @@
     ++j;
   }
   if (j != temp.elements_end())
-    throw Error("Unexpected element");
+    NDN_THROW(Error("Unexpected element"));
 
   if (m_participants.empty())
-    throw Error("No participant in the chatroom");
+    NDN_THROW(Error("No participant in the chatroom"));
 
   ++i;
 
   if (i != m_wire.elements_end()) {
-    throw Error("Unexpected element");
+    NDN_THROW(Error("Unexpected element"));
   }
 }
 
diff --git a/src/chatroom-info.hpp b/src/chatroom-info.hpp
index 81e0fde..2572193 100644
--- a/src/chatroom-info.hpp
+++ b/src/chatroom-info.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -64,7 +64,7 @@
   const Name::Component&
   getName() const;
 
-  const TrustModel
+  TrustModel
   getTrustModel() const;
 
   const Name&
@@ -115,7 +115,7 @@
   return m_chatroomName;
 }
 
-inline const ChatroomInfo::TrustModel
+inline ChatroomInfo::TrustModel
 ChatroomInfo::getTrustModel() const
 {
   return m_trustModel;
diff --git a/src/common.hpp b/src/common.hpp
index 3b14f79..90f5e54 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -1,6 +1,13 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * COPYRIGHT MSG GOES HERE...
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2020, Regents of the University of California
+ *                     Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Mengjin Yan <jane.yan0129@gmail.com>
+ *         Yingdi Yu <yingdi@cs.ucla.edu>
+ *         Qiuhan Ding <qiuhanding@cs.ucla.edu>
  */
 
 #ifndef CHRONOCHAT_COMMON_HPP
@@ -22,51 +29,33 @@
 
 #include <cstddef>
 #include <list>
-#include <set>
 #include <map>
-#include <queue>
 #include <vector>
 #include <string>
 
+#include <boost/assert.hpp>
+
 #include <ndn-cxx/interest.hpp>
 #include <ndn-cxx/data.hpp>
 
-#include <boost/algorithm/string.hpp>
-#include <boost/asio.hpp>
-#include <boost/assert.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/noncopyable.hpp>
-#include <boost/property_tree/ptree.hpp>
-
 namespace chronochat {
 
 using std::size_t;
 
-using boost::noncopyable;
-
 using std::shared_ptr;
 using std::unique_ptr;
-using std::weak_ptr;
-using std::enable_shared_from_this;
 using std::make_shared;
-using std::static_pointer_cast;
-using std::dynamic_pointer_cast;
-using std::const_pointer_cast;
 using std::function;
 using std::bind;
-using std::ref;
-using std::cref;
 
 using ndn::Interest;
 using ndn::Data;
 using ndn::Name;
 using ndn::Block;
-using ndn::Signature;
-using ndn::KeyLocator;
 
 namespace tlv {
 using namespace ndn::tlv;
-}
+} // namespace tlv
 
 namespace name = ndn::name;
 namespace time = ndn::time;
diff --git a/src/conf.cpp b/src/conf.cpp
index d02fe08..db44604 100644
--- a/src/conf.cpp
+++ b/src/conf.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -79,14 +79,14 @@
   //            String
 
   if (m_wire.type() != tlv::Conf)
-    throw Error("Unexpected TLV number when decoding conf packet");
+    NDN_THROW(Error("Unexpected TLV number when decoding conf packet"));
 
   // Identity
   Block::element_const_iterator i = m_wire.elements_begin();
   if (i == m_wire.elements_end())
-    throw Error("Missing Identity");
+    NDN_THROW(Error("Missing Identity"));
   if (i->type() != tlv::Name)
-    throw Error("Expect Identity but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Identity but get TLV Type " + std::to_string(i->type())));
 
   m_identity.wireDecode(*i);
   ++i;
@@ -95,15 +95,14 @@
   if (i == m_wire.elements_end())
     return;
   if (i->type() != tlv::Nick)
-    throw Error("Expect Nick but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Nick but get TLV Type " + std::to_string(i->type())));
 
   m_nick = std::string(reinterpret_cast<const char* >(i->value()),
                        i->value_size());
   ++i;
 
-  if (i != m_wire.elements_end()) {
-    throw Error("Unexpected element");
-  }
+  if (i != m_wire.elements_end())
+    NDN_THROW(Error("Unexpected element"));
 }
 
 void
diff --git a/src/conf.hpp b/src/conf.hpp
index 3b4f394..8df9f62 100644
--- a/src/conf.hpp
+++ b/src/conf.hpp
@@ -1,21 +1,17 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
  * Author: Qiuhan Ding <qiuhanding@cs.ucla.edu>
  */
 
-#ifndef CHRONOCHAT_CONFIG_HPP
-#define CHRONOCHAT_CONFIG_HPP
+#ifndef CHRONOCHAT_CONF_HPP
+#define CHRONOCHAT_CONF_HPP
 
 #include "common.hpp"
 #include "tlv.hpp"
-#include <ndn-cxx/util/concepts.hpp>
-#include <ndn-cxx/encoding/block.hpp>
-#include <ndn-cxx/encoding/encoding-buffer.hpp>
-#include <list>
 
 namespace chronochat {
 
@@ -84,4 +80,4 @@
 
 } // namespace chronochat
 
-#endif //CHRONOCHAT_CONF_HPP
+#endif // CHRONOCHAT_CONF_HPP
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index 2bb5153..5a5f5bb 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013-2016, Regents of the University of California
+ * Copyright (c) 2013-2020, Regents of the University of California
  *                          Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -9,10 +9,6 @@
  *         Qiuhan Ding <qiuhanding@cs.ucla.edu>
  */
 
-#if __clang__
-#pragma clang diagnostic ignored "-Wtautological-compare"
-#endif
-
 #include "contact-manager.hpp"
 #include <QStringList>
 #include <QFile>
@@ -28,7 +24,6 @@
 #include <boost/asio.hpp>
 #include <boost/tokenizer.hpp>
 #include <boost/filesystem.hpp>
-#include "logging.h"
 #endif
 
 namespace fs = boost::filesystem;
@@ -97,6 +92,7 @@
 
   Interest interest(interestName);
   interest.setInterestLifetime(time::milliseconds(1000));
+  interest.setCanBePrefix(true);
   interest.setMustBeFresh(false);
 
   m_face.expressInterest(interest,
@@ -112,17 +108,14 @@
 void
 ContactManager::prepareEndorseInfo(const Name& identity)
 {
-  // _LOG_DEBUG("prepareEndorseInfo");
   const Profile& profile = m_bufferedContacts[identity].m_selfEndorseCert->getProfile();
 
   shared_ptr<EndorseInfo> endorseInfo = make_shared<EndorseInfo>();
   m_bufferedContacts[identity].m_endorseInfo = endorseInfo;
 
   map<string, size_t> endorseCount;
-  for (Profile::const_iterator pIt = profile.begin(); pIt != profile.end(); pIt++) {
-    // _LOG_DEBUG("prepareEndorseInfo: profile[" << pIt->first << "]: " << pIt->second);
+  for (Profile::const_iterator pIt = profile.begin(); pIt != profile.end(); pIt++)
     endorseCount[pIt->first] = 0;
-  }
 
   size_t endorseCertCount = 0;
 
@@ -179,13 +172,13 @@
     else
       emit contactInfoFetchFailed(QString::fromStdString(identity.toUri() + ": verification failed"));
   }
-  catch(Block::Error& e) {
+  catch (const Block::Error& e) {
     emit contactInfoFetchFailed(QString::fromStdString(identity.toUri() + ": block error " + e.what()));
   }
-  catch(EndorseCertificate::Error& e) {
+  catch (const EndorseCertificate::Error& e) {
     emit contactInfoFetchFailed(QString::fromStdString(identity.toUri() + ": cert error " + e.what()));
   }
-  catch(Data::Error& e) {
+  catch (const Data::Error& e) {
     emit contactInfoFetchFailed(QString::fromStdString(identity.toUri() + ": data error " + e.what()));
   }
 }
@@ -219,7 +212,7 @@
     m_bufferedContacts[identity].m_endorseCollection = endorseCollection;
     fetchEndorseCertificateInternal(identity, 0);
   }
-  catch (std::runtime_error&) {
+  catch (const std::runtime_error&) {
     prepareEndorseInfo(identity);
   }
 }
@@ -235,7 +228,6 @@
 void
 ContactManager::onDnsCollectEndorseTimeoutNotify(const Interest& interest, const Name& identity)
 {
-  // _LOG_DEBUG("onDnsCollectEndorseTimeoutNotify: " << interest.getName());
   prepareEndorseInfo(identity);
 }
 
@@ -283,6 +275,7 @@
 
       Interest interest(interestName);
       interest.setMustBeFresh(true);
+      interest.setCanBePrefix(true);
       interest.setInterestLifetime(time::milliseconds(1000));
 
       ndn::security::DataValidationSuccessCallback onValidated =
@@ -368,14 +361,12 @@
 ContactManager::onIdentityCertValidationFailed(const Data& data,
                                                const ndn::security::ValidationError& error)
 {
-  // _LOG_DEBUG("ContactManager::onIdentityCertValidationFailed " << data->getName());
   decreaseIdCertCount();
 }
 
 void
 ContactManager::onIdentityCertTimeoutNotify(const Interest& interest)
 {
-  // _LOG_DEBUG("ContactManager::onIdentityCertTimeoutNotify: " << interest.getName());
   decreaseIdCertCount();
 }
 
@@ -527,7 +518,6 @@
                                 const ndn::security::DataValidationFailureCallback& onValidationFailed,
                                 const TimeoutNotify& timeoutNotify)
 {
-  // _LOG_DEBUG("On interest timeout: " << interest.getName());
   if (retry > 0)
     sendInterest(interest, onValidated, onValidationFailed, timeoutNotify, retry-1);
   else
@@ -578,7 +568,7 @@
                                                 .getDefaultCertificate();
     if (cert.getKeyName() == interestName)
       return m_face.put(cert);
-  } catch (ndn::security::Pib::Error&) {}
+  } catch (const ndn::security::Pib::Error&) {}
 
   data = m_contactStorage->getSelfEndorseCertificate();
   if (static_cast<bool>(data) && data->getKeyName().equals(interestName))
@@ -597,38 +587,20 @@
 
   m_contactStorage = make_shared<ContactStorage>(m_identity);
 
-  Name dnsPrefix;
-  dnsPrefix.append(m_identity).append("DNS");
-  auto dnsListenerId = make_shared<ndn::RegisteredPrefixHandle>(
-    m_face.setInterestFilter(dnsPrefix,
-                             bind(&ContactManager::onDnsInterest, this, _1, _2),
-                             bind(&ContactManager::onDnsRegisterFailed, this, _1, _2)));
+  m_dnsListenerHandle = m_face.setInterestFilter(
+    Name(m_identity).append("DNS"),
+    bind(&ContactManager::onDnsInterest, this, _1, _2),
+    bind(&ContactManager::onDnsRegisterFailed, this, _1, _2));
 
-  Name keyPrefix;
-  keyPrefix.append(m_identity).append("KEY");
-  auto keyListenerId = make_shared<ndn::RegisteredPrefixHandle>(
-    m_face.setInterestFilter(keyPrefix,
-                             bind(&ContactManager::onKeyInterest, this, _1, _2),
-                             bind(&ContactManager::onDnsRegisterFailed, this, _1, _2)));
+  m_keyListenerHandle = m_face.setInterestFilter(
+    Name(m_identity).append("KEY"),
+    bind(&ContactManager::onKeyInterest, this, _1, _2),
+    bind(&ContactManager::onDnsRegisterFailed, this, _1, _2));
 
-  Name profileCertPrefix;
-  profileCertPrefix.append(m_identity).append("PROFILE-CERT");
-  auto profileCertListenerId = make_shared<ndn::RegisteredPrefixHandle>(
-    m_face.setInterestFilter(profileCertPrefix,
-                             bind(&ContactManager::onKeyInterest, this, _1, _2),
-                             bind(&ContactManager::onDnsRegisterFailed, this, _1, _2)));
-
-  if (m_dnsListenerId != 0)
-    m_dnsListenerId->unregister();
-  m_dnsListenerId = dnsListenerId;
-
-  if (m_keyListenerId != 0)
-    m_keyListenerId->unregister();
-  m_keyListenerId = keyListenerId;
-
-  if (m_profileCertListenerId != 0)
-    m_profileCertListenerId->unregister();
-  m_profileCertListenerId = profileCertListenerId;
+  m_profileCertListenerHandle = m_face.setInterestFilter(
+    Name(m_identity).append("PROFILE-CERT"),
+    bind(&ContactManager::onKeyInterest, this, _1, _2),
+    bind(&ContactManager::onDnsRegisterFailed, this, _1, _2));
 
   m_contactList.clear();
   m_contactStorage->getAllContacts(m_contactList);
@@ -647,10 +619,9 @@
   Name interestName;
   interestName.append(identityName).append("DNS").append("PROFILE");
 
-  // _LOG_DEBUG("onFetchContactInfo " << identity.toStdString() << " profile: " << interestName);
-
   Interest interest(interestName);
   interest.setInterestLifetime(time::milliseconds(1000));
+  interest.setCanBePrefix(true);
   interest.setMustBeFresh(true);
 
   ndn::security::DataValidationSuccessCallback onValidated =
@@ -666,14 +637,12 @@
 void
 ContactManager::onAddFetchedContact(const QString& identity)
 {
-  // _LOG_DEBUG("onAddFetchedContact");
-
   Name identityName(identity.toStdString());
 
   BufferedContacts::const_iterator it = m_bufferedContacts.find(identityName);
   if (it != m_bufferedContacts.end()) {
     Contact contact(*(it->second.m_selfEndorseCert));
-    // _LOG_DEBUG("onAddFetchedContact: contact ready");
+
     try {
       m_contactStorage->addContact(contact);
       m_bufferedContacts.erase(identityName);
@@ -683,7 +652,7 @@
 
       onWaitForContactList();
     }
-    catch(ContactStorage::Error& e) {
+    catch (const ContactStorage::Error& e) {
       emit warning(QString::fromStdString(e.what()));
     }
   }
@@ -699,8 +668,6 @@
   if (!static_cast<bool>(newProfile))
     return;
 
-  // _LOG_DEBUG("ContactManager::onUpdateProfile: getProfile");
-
   shared_ptr<EndorseCertificate> newEndorseCertificate =
     getSignedSelfEndorseCertificate(*newProfile);
 
@@ -773,7 +740,7 @@
       if (!it->empty())
         bufferedIdCertNames.push_back(*it);
   }
-  catch(std::exception &e) {
+  catch (const std::exception& e) {
     emit warning(QString::fromStdString("Fail to fetch certificate directory! #N"));
   }
 
@@ -790,6 +757,7 @@
     Interest interest(certName);
     interest.setInterestLifetime(time::milliseconds(1000));
     interest.setMustBeFresh(true);
+    interest.setCanBePrefix(true);
 
     ndn::security::DataValidationSuccessCallback onValidated =
     bind(&ContactManager::onIdentityCertValidated, this, _1);
@@ -829,7 +797,7 @@
 
       onWaitForContactList();
     }
-    catch(ContactStorage::Error& e) {
+    catch (const ContactStorage::Error& e) {
       emit warning(QString::fromStdString(e.what()));
     }
   }
@@ -908,5 +876,4 @@
 
 #if WAF
 #include "contact-manager.moc"
-// #include "contact-manager.cpp.moc"
 #endif
diff --git a/src/contact-manager.hpp b/src/contact-manager.hpp
index b475eb4..456a19d 100644
--- a/src/contact-manager.hpp
+++ b/src/contact-manager.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -256,7 +256,8 @@
 
 private:
 
-  class FetchedInfo {
+  class FetchedInfo
+  {
   public:
     shared_ptr<EndorseCertificate> m_selfEndorseCert;
     shared_ptr<EndorseCollection> m_endorseCollection;
@@ -283,9 +284,9 @@
   BufferedIdCerts m_bufferedIdCerts;
 
   // Tmp Dns
-  shared_ptr<ndn::RegisteredPrefixHandle> m_dnsListenerId;
-  shared_ptr<ndn::RegisteredPrefixHandle> m_keyListenerId;
-  shared_ptr<ndn::RegisteredPrefixHandle> m_profileCertListenerId;
+  ndn::ScopedRegisteredPrefixHandle m_dnsListenerHandle;
+  ndn::ScopedRegisteredPrefixHandle m_keyListenerHandle;
+  ndn::ScopedRegisteredPrefixHandle m_profileCertListenerHandle;
 
   RecLock m_collectCountMutex;
   size_t m_collectCount;
diff --git a/src/contact-panel.cpp b/src/contact-panel.cpp
index 8841d5d..04b68d5 100644
--- a/src/contact-panel.cpp
+++ b/src/contact-panel.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -18,12 +18,6 @@
 #include <QtSql/QSqlField>
 #include <QtSql/QSqlError>
 
-#ifndef Q_MOC_RUN
-#include "logging.h"
-#endif
-
-// INIT_LOGGER("ContactPanel");
-
 namespace chronochat {
 
 ContactPanel::ContactPanel(QWidget *parent)
@@ -129,15 +123,10 @@
 void
 ContactPanel::onCloseDBModule()
 {
-  // _LOG_DEBUG("close db module");
-  if (m_trustScopeModel) {
+  if (m_trustScopeModel)
     delete m_trustScopeModel;
-    // _LOG_DEBUG("trustScopeModel closed");
-  }
-  if (m_endorseDataModel) {
+  if (m_endorseDataModel)
     delete m_endorseDataModel;
-    // _LOG_DEBUG("endorseDataModel closed");
-  }
 }
 
 void
@@ -211,8 +200,8 @@
 
 // private slots
 void
-ContactPanel::onSelectionChanged(const QItemSelection &selected,
-                                 const QItemSelection &deselected)
+ContactPanel::onSelectionChanged(const QItemSelection& selected,
+                                 const QItemSelection& deselected)
 {
   QModelIndexList items = selected.indexes();
   QString alias = m_contactListModel->data(items.first(), Qt::DisplayRole).toString();
@@ -341,5 +330,4 @@
 
 #if WAF
 #include "contact-panel.moc"
-// #include "contact-panel.cpp.moc"
 #endif
diff --git a/src/contact-panel.hpp b/src/contact-panel.hpp
index 7eec224..737b487 100644
--- a/src/contact-panel.hpp
+++ b/src/contact-panel.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -11,20 +11,20 @@
 #ifndef CHRONOCHAT_CONTACT_PANEL_HPP
 #define CHRONOCHAT_CONTACT_PANEL_HPP
 
+#include "set-alias-dialog.hpp"
+#include "endorse-combobox-delegate.hpp"
+
 #include <QDialog>
 #include <QStringListModel>
 #include <QSqlTableModel>
 #include <QItemSelection>
 
-#include "set-alias-dialog.hpp"
-#include "endorse-combobox-delegate.hpp"
-
 #ifndef Q_MOC_RUN
 #endif
 
 namespace Ui {
 class ContactPanel;
-}
+} // namespace Ui
 
 namespace chronochat {
 
diff --git a/src/contact-storage.cpp b/src/contact-storage.cpp
index d5e0fe2..76ae31d 100644
--- a/src/contact-storage.cpp
+++ b/src/contact-storage.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -10,10 +10,9 @@
  */
 
 #include "contact-storage.hpp"
-
-#include <boost/filesystem.hpp>
 #include "cryptopp.hpp"
 
+#include <boost/filesystem.hpp>
 
 namespace chronochat {
 
@@ -167,7 +166,7 @@
 
   int res = sqlite3_open((chronosDir / getDBName()).c_str(), &m_db);
   if (res != SQLITE_OK)
-    throw Error("chronochat DB cannot be open/created");
+    NDN_THROW(Error("chronochat DB cannot be open/created"));
 
   initializeTable("SelfProfile", INIT_SP_TABLE);
   initializeTable("SelfEndorse", INIT_SE_TABLE);
@@ -215,9 +214,9 @@
 
   if (!tableExist) {
     char *errmsg = 0;
-    res = sqlite3_exec(m_db, sqlCreateStmt.c_str (), NULL, NULL, &errmsg);
+    res = sqlite3_exec(m_db, sqlCreateStmt.c_str (), nullptr, nullptr, &errmsg);
     if (res != SQLITE_OK && errmsg != 0)
-      throw Error("Init \"error\" in " + tableName);
+      NDN_THROW(Error("Init \"error\" in " + tableName));
   }
 }
 
@@ -396,7 +395,7 @@
 ContactStorage::addContact(const Contact& contact)
 {
   if (doesContactExist(contact.getNameSpace()))
-    throw Error("Normal Contact has already existed");
+    NDN_THROW(Error("Normal Contact has already existed"));
 
   string identity = contact.getNameSpace().toUri();
   bool isIntroducer = contact.isIntroducer();
diff --git a/src/contact-storage.hpp b/src/contact-storage.hpp
index 10bb117..b4f4e04 100644
--- a/src/contact-storage.hpp
+++ b/src/contact-storage.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -25,7 +25,7 @@
   class Error : public std::runtime_error
   {
   public:
-    Error(const std::string &what)
+    Error(const std::string& what)
       : std::runtime_error(what)
     {
     }
diff --git a/src/contact.hpp b/src/contact.hpp
index b0fe674..4b04b47 100644
--- a/src/contact.hpp
+++ b/src/contact.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -12,11 +12,12 @@
 #define CHRONOCHAT_CONTACT_HPP
 
 #include "common.hpp"
-#include <ndn-cxx/security/certificate.hpp>
-#include <ndn-cxx/util/regex.hpp>
 #include "endorse-certificate.hpp"
 #include "profile.hpp"
 
+#include <ndn-cxx/security/certificate.hpp>
+#include <ndn-cxx/util/regex.hpp>
+
 namespace chronochat {
 
 class Contact
@@ -45,7 +46,7 @@
     try {
       m_notBefore = identityCertificate.getValidityPeriod().getPeriod().first;
       m_notAfter = identityCertificate.getValidityPeriod().getPeriod().second;
-    } catch (tlv::Error&) {}
+    } catch (const tlv::Error&) {}
   }
 
   Contact(const EndorseCertificate& endorseCertificate,
@@ -69,7 +70,7 @@
     try {
       m_notBefore = endorseCertificate.getValidityPeriod().getPeriod().first;
       m_notAfter = endorseCertificate.getValidityPeriod().getPeriod().second;
-    } catch (tlv::Error&) {}
+    } catch (const tlv::Error&) {}
   }
 
   Contact(const Name& identity,
diff --git a/src/controller-backend.cpp b/src/controller-backend.cpp
index 7c6b8a5..9078cf2 100644
--- a/src/controller-backend.cpp
+++ b/src/controller-backend.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013-2016, Regents of the University of California
+ * Copyright (c) 2013-2020, Regents of the University of California
  *                          Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -12,11 +12,14 @@
 #include "controller-backend.hpp"
 
 #ifndef Q_MOC_RUN
+#include <iostream>
+#include <boost/asio.hpp>
+
 #include <ndn-cxx/util/segment-fetcher.hpp>
 #include <ndn-cxx/security/signing-helpers.hpp>
 #include <ndn-cxx/security/certificate-fetcher-offline.hpp>
+
 #include "invitation.hpp"
-#include <iostream>
 #endif
 
 namespace chronochat {
@@ -58,7 +61,7 @@
       setInvitationListener();
       m_face.processEvents();
     }
-    catch (std::runtime_error& e) {
+    catch (const std::runtime_error& e) {
       {
         std::lock_guard<std::mutex>lock(m_nfdConnectionMutex);
         m_isNfdConnected = false;
@@ -136,35 +139,13 @@
   invitationPrefix.append(m_identity).append("CHRONOCHAT-INVITATION");
   requestPrefix.append(m_identity).append("CHRONOCHAT-INVITATION-REQUEST");
 
-  auto invitationListenerId =
-    make_shared<ndn::RegisteredPrefixHandle>(m_face.setInterestFilter(invitationPrefix,
-                             bind(&ControllerBackend::onInvitationInterest,
-                                  this, _1, _2, offset),
-                             bind(&ControllerBackend::onInvitationRegisterFailed,
-                                  this, _1, _2)));
+  m_invitationListenerHandle = m_face.setInterestFilter(invitationPrefix,
+    bind(&ControllerBackend::onInvitationInterest, this, _1, _2, offset),
+    bind(&ControllerBackend::onInvitationRegisterFailed, this, _1, _2));
 
-  if (m_invitationListenerId != 0) {
-    invitationListenerId->unregister(
-      bind(&ControllerBackend::onInvitationPrefixReset, this),
-      bind(&ControllerBackend::onInvitationPrefixResetFailed, this, _1));
-  }
-
-  m_invitationListenerId = invitationListenerId;
-
-  auto requestListenerId =
-    make_shared<ndn::RegisteredPrefixHandle>(
-      m_face.setInterestFilter(requestPrefix,
-                               bind(&ControllerBackend::onInvitationRequestInterest,
-                                    this, _1, _2, offset),
-                               [] (const Name& prefix, const std::string& failInfo) {}));
-
-  if (m_requestListenerId != 0) {
-    m_requestListenerId->unregister(
-      []{},
-      [] (const std::string& failInfo) {});
-  }
-
-  m_requestListenerId = requestListenerId;
+  m_requestListenerHandle = m_face.setInterestFilter(requestPrefix,
+    bind(&ControllerBackend::onInvitationRequestInterest, this, _1, _2, offset),
+    [] (const Name& prefix, const std::string& failInfo) {});
 }
 
 ndn::Name
@@ -173,25 +154,12 @@
   return Name("/ndn/broadcast");
 }
 
-void
-ControllerBackend::onInvitationPrefixReset()
-{
-  // _LOG_DEBUG("ControllerBackend::onInvitationPrefixReset");
-}
-
-void
-ControllerBackend::onInvitationPrefixResetFailed(const std::string& failInfo)
-{
-  // _LOG_DEBUG("ControllerBackend::onInvitationPrefixResetFailed: " << failInfo);
-}
-
 
 void
 ControllerBackend::onInvitationInterest(const ndn::Name& prefix,
                                         const ndn::Interest& interest,
                                         size_t routingPrefixOffset)
 {
-  // _LOG_DEBUG("onInvitationInterest: " << interest.getName());
   shared_ptr<Interest> invitationInterest =
     make_shared<Interest>(interest.getName().getSubName(routingPrefixOffset));
 
@@ -201,7 +169,7 @@
       if (m_chatDialogList.contains(QString::fromStdString(invitation.getChatroom())))
         return;
   }
-  catch (Invitation::Error& e) {
+  catch (const Invitation::Error& e) {
     // Cannot parse the invitation;
     return;
   }
@@ -215,7 +183,6 @@
 void
 ControllerBackend::onInvitationRegisterFailed(const Name& prefix, const std::string& failInfo)
 {
-  // _LOG_DEBUG("ControllerBackend::onInvitationRegisterFailed: " << failInfo);
 }
 
 void
@@ -258,8 +225,6 @@
 ControllerBackend::onInvitationValidationFailed(const Interest& interest,
                                                 const ndn::security::ValidationError& failureInfo)
 {
-  // _LOG_DEBUG("Invitation: " << interest->getName() <<
-  //            " cannot not be validated due to: " << failureInfo);
 }
 
 void
@@ -288,7 +253,7 @@
         prefix = Name("/private/local");
     }
   }
-  catch (Block::Error& e) {
+  catch (const Block::Error& e) {
     prefix = Name("/private/local");
   }
 
@@ -441,8 +406,6 @@
       .append(ROUTING_HINT_SEPARATOR)
       .append(response->getName());
 
-    // _LOG_DEBUG("onInvitationResponded: prepare reply " << wrappedName);
-
     shared_ptr<Data> wrappedData = make_shared<Data>(wrappedName);
     wrappedData->setContent(response->wireEncode());
     wrappedData->setFreshnessPeriod(time::milliseconds(1000));
@@ -485,6 +448,7 @@
   Interest interest(interestName);
   interest.setInterestLifetime(time::milliseconds(10000));
   interest.setMustBeFresh(true);
+  interest.setCanBePrefix(true);
   interest.getNonce();
   m_face.expressInterest(interest,
                          bind(&ControllerBackend::onRequestResponse, this, _1, _2),
@@ -517,5 +481,4 @@
 
 #if WAF
 #include "controller-backend.moc"
-// #include "controller-backend.cpp.moc"
 #endif
diff --git a/src/controller-backend.hpp b/src/controller-backend.hpp
index 18b1cd8..2e3aa9f 100644
--- a/src/controller-backend.hpp
+++ b/src/controller-backend.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -57,12 +57,6 @@
   getInvitationRoutingPrefix();
 
   void
-  onInvitationPrefixReset();
-
-  void
-  onInvitationPrefixResetFailed(const std::string& failInfo);
-
-  void
   onInvitationInterest(const ndn::Name& prefix, const ndn::Interest& interest,
                        size_t routingPrefixOffset);
 
@@ -170,8 +164,8 @@
   ndn::security::ValidatorNull m_nullValidator;
 
   // RegisteredPrefixId
-  shared_ptr<ndn::RegisteredPrefixHandle> m_invitationListenerId;
-  shared_ptr<ndn::RegisteredPrefixHandle> m_requestListenerId;
+  ndn::ScopedRegisteredPrefixHandle m_invitationListenerHandle;
+  ndn::ScopedRegisteredPrefixHandle m_requestListenerHandle;
 
   // ChatRoomList
   QStringList m_chatDialogList;
diff --git a/src/controller.cpp b/src/controller.cpp
index d41b65d..b8b2c97 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -9,23 +9,18 @@
  *         Qiuhan Ding <qiuhanding@cs.ucla.edu>
  */
 
+#include "controller.hpp"
+#include "cryptopp.hpp"
+#include "conf.hpp"
+#include "endorse-info.hpp"
+
 #include <QApplication>
 #include <QMessageBox>
 #include <QDir>
 #include <QTimer>
-#include "controller.hpp"
 
-#ifndef Q_MOC_RUN
 #include <boost/filesystem.hpp>
-#include <boost/lexical_cast.hpp>
 #include <ndn-cxx/util/random.hpp>
-#include "cryptopp.hpp"
-#include "logging.h"
-#include "conf.hpp"
-#include "endorse-info.hpp"
-#endif
-
-INIT_LOGGER("chronochat.Controller");
 
 Q_DECLARE_METATYPE(ndn::Name)
 Q_DECLARE_METATYPE(ndn::security::Certificate)
@@ -286,9 +281,6 @@
   m_db.setDatabaseName(path);
 
   m_db.open();
-
-  // bool ok = m_db.open();
-  // _LOG_DEBUG("DB opened: " << std::boolalpha << ok );
 }
 
 void
@@ -322,12 +314,12 @@
     else
       m_nick = m_identity.get(-1).toUri();
   }
-  catch (tlv::Error&) {
+  catch (const tlv::Error&) {
     try {
       ndn::KeyChain keyChain;
       m_identity = keyChain.getPib().getDefaultIdentity().getName();
     }
-    catch (ndn::security::pib::Pib::Error&) {
+    catch (const ndn::security::pib::Pib::Error&) {
       m_identity.clear();
       m_identity.append("chronochat-tmp-identity")
                 .append(getRandomString());
@@ -553,7 +545,6 @@
 Controller::onIdentityUpdatedContinued()
 {
   QString connection = m_db.connectionName();
-  // _LOG_DEBUG("connection name: " << connection.toStdString());
   QSqlDatabase::removeDatabase(connection);
   m_db.close();
 
@@ -839,5 +830,4 @@
 
 #if WAF
 #include "controller.moc"
-// #include "controller.cpp.moc"
 #endif
diff --git a/src/digest-tree-scene.cpp b/src/digest-tree-scene.cpp
index 55d9a36..093b33d 100644
--- a/src/digest-tree-scene.cpp
+++ b/src/digest-tree-scene.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -165,7 +165,7 @@
 }
 
 void
-DigestTreeScene::plotEdge(const std::vector<TreeLayout::Coordinate> &childNodesCo, int nodeSize)
+DigestTreeScene::plotEdge(const std::vector<TreeLayout::Coordinate>& childNodesCo, int nodeSize)
 {
   int n = childNodesCo.size();
   for (int i = 0; i < n; i++) {
@@ -275,5 +275,4 @@
 
 #if WAF
 #include "digest-tree-scene.moc"
-// #include "digest-tree-scene.cpp.moc"
 #endif
diff --git a/src/digest-tree-scene.hpp b/src/digest-tree-scene.hpp
index 562feeb..57d6387 100644
--- a/src/digest-tree-scene.hpp
+++ b/src/digest-tree-scene.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
diff --git a/src/discovery-panel.cpp b/src/discovery-panel.cpp
index 06c7cf7..4c5dcf7 100644
--- a/src/discovery-panel.cpp
+++ b/src/discovery-panel.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -105,7 +105,7 @@
   ui->NameData->setText(QString::fromStdString(info.getName().toUri()));
   ui->NameSpaceData->setText(QString::fromStdString(info.getSyncPrefix().toUri()));
 
-  switch(info.getTrustModel()) {
+  switch (info.getTrustModel()) {
   case 2:
     {
       ui->TrustModelData->setText(QString("Hierarchical"));
@@ -162,8 +162,8 @@
 
 // private slots
 void
-DiscoveryPanel::onSelectedChatroomChanged(const QItemSelection &selected,
-                                          const QItemSelection &deselected)
+DiscoveryPanel::onSelectedChatroomChanged(const QItemSelection& selected,
+                                          const QItemSelection& deselected)
 {
   QModelIndexList items = selected.indexes();
   QString chatroomName = m_chatroomListModel->data(items.first(), Qt::DisplayRole).toString();
@@ -187,8 +187,8 @@
 }
 
 void
-DiscoveryPanel::onSelectedParticipantChanged(const QItemSelection &selected,
-                                             const QItemSelection &deselected)
+DiscoveryPanel::onSelectedParticipantChanged(const QItemSelection& selected,
+                                             const QItemSelection& deselected)
 {
   if (m_isParticipant)
     return;
@@ -231,5 +231,4 @@
 
 #if WAF
 #include "discovery-panel.moc"
-// #include "discovery-panel.cpp.moc"
 #endif
diff --git a/src/discovery-panel.hpp b/src/discovery-panel.hpp
index 473283f..59c07b8 100644
--- a/src/discovery-panel.hpp
+++ b/src/discovery-panel.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -21,7 +21,7 @@
 
 namespace Ui {
 class DiscoveryPanel;
-}
+} // namespace Ui
 
 namespace chronochat {
 
diff --git a/src/endorse-certificate.cpp b/src/endorse-certificate.cpp
index f9286c6..42b1cb1 100644
--- a/src/endorse-certificate.cpp
+++ b/src/endorse-certificate.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -10,12 +10,12 @@
  */
 
 #include "endorse-certificate.hpp"
+#include "endorse-extension.hpp"
+
 #include <boost/iostreams/stream.hpp>
 #include <ndn-cxx/encoding/buffer-stream.hpp>
 #include <ndn-cxx/security/additional-description.hpp>
 #include <ndn-cxx/security/validity-period.hpp>
-#include "endorse-extension.hpp"
-#include <list>
 
 namespace chronochat {
 
@@ -81,7 +81,7 @@
 
   try {
     signatureInfo.setValidityPeriod(kskCertificate.getValidityPeriod());
-  } catch (tlv::Error&) {
+  } catch (const tlv::Error&) {
     signatureInfo.setValidityPeriod(ndn::security::ValidityPeriod(
       time::system_clock::now(), time::system_clock::now() + time::days(3650)));
   }
@@ -121,7 +121,7 @@
 
   try {
     signatureInfo.setValidityPeriod(endorseCertificate.getValidityPeriod());
-  } catch (tlv::Error&) {
+  } catch (const tlv::Error&) {
     signatureInfo.setValidityPeriod(ndn::security::ValidityPeriod(
       time::system_clock::now(), time::system_clock::now() + time::days(3650)));
   }
diff --git a/src/endorse-certificate.hpp b/src/endorse-certificate.hpp
index defc8a8..62bbb5a 100644
--- a/src/endorse-certificate.hpp
+++ b/src/endorse-certificate.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
diff --git a/src/endorse-collection.cpp b/src/endorse-collection.cpp
index 9b937a7..a4c6a44 100644
--- a/src/endorse-collection.cpp
+++ b/src/endorse-collection.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -86,13 +86,13 @@
   m_entries.clear();
 
   if (m_wire.type() != tlv::EndorseCollection)
-    throw Error("Unexpected TLV number when decoding endorse collection packet");
+    NDN_THROW(Error("Unexpected TLV number when decoding endorse collection packet"));
 
   Block::element_const_iterator i = m_wire.elements_begin();
   if (i == m_wire.elements_end())
-    throw Error("Missing Endorse Collection Entry");
+    NDN_THROW(Error("Missing Endorse Collection Entry"));
   if (i->type() != tlv::EndorseCollectionEntry)
-    throw Error("Expect Endorse Collection Entry but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Endorse Collection Entry but get TLV Type " + std::to_string(i->type())));
 
   while (i != m_wire.elements_end() && i->type() == tlv::EndorseCollectionEntry) {
     CollectionEntry entry;
@@ -100,31 +100,30 @@
     temp.parse();
     Block::element_const_iterator j = temp.elements_begin();
     if (j == temp.elements_end())
-      throw Error("Missing Cert Name");
+      NDN_THROW(Error("Missing Cert Name"));
     if (j->type() != tlv::Name)
-      throw Error("Expect Cert Name but get TLV Type " + std::to_string(j->type()));
+      NDN_THROW(Error("Expect Cert Name but get TLV Type " + std::to_string(j->type())));
 
     entry.certName.wireDecode(*j);
 
     ++j;
     if (j == temp.elements_end())
-      throw Error("Missing Hash");
+      NDN_THROW(Error("Missing Hash"));
     if (j->type() != tlv::Hash)
-      throw Error("Expect Hash but get TLV Type " + std::to_string(j->type()));
+      NDN_THROW(Error("Expect Hash but get TLV Type " + std::to_string(j->type())));
 
     entry.hash = std::string(reinterpret_cast<const char* >(j->value()),
                              j->value_size());
     ++j;
-    if (j != temp.elements_end()) {
-      throw Error("Unexpected element");
-    }
+    if (j != temp.elements_end())
+      NDN_THROW(Error("Unexpected element"));
+
     m_entries.push_back(entry);
     ++i;
   }
 
-  if (i != m_wire.elements_end()) {
-      throw Error("Unexpected element");
-  }
+  if (i != m_wire.elements_end())
+      NDN_THROW(Error("Unexpected element"));
 }
 
 void
diff --git a/src/endorse-collection.hpp b/src/endorse-collection.hpp
index dd16bc3..1371839 100644
--- a/src/endorse-collection.hpp
+++ b/src/endorse-collection.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -77,4 +77,4 @@
 
 } // namespace chronochat
 
-#endif //CHRONOCHAT_ENDORSE_COLLECTION_HPP
+#endif // CHRONOCHAT_ENDORSE_COLLECTION_HPP
diff --git a/src/endorse-combobox-delegate.cpp b/src/endorse-combobox-delegate.cpp
index 319135a..d753c87 100644
--- a/src/endorse-combobox-delegate.cpp
+++ b/src/endorse-combobox-delegate.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -13,10 +13,6 @@
 #include <QComboBox>
 #include <QApplication>
 
-#ifndef Q_MOC_RUN
-#include "logging.h"
-#endif
-
 namespace chronochat {
 
 EndorseComboBoxDelegate::EndorseComboBoxDelegate(QObject* parent)
@@ -80,5 +76,4 @@
 
 #if WAF
 #include "endorse-combobox-delegate.moc"
-// #include "endorse-combobox-delegate.cpp.moc"
 #endif
diff --git a/src/endorse-combobox-delegate.hpp b/src/endorse-combobox-delegate.hpp
index 0611461..16ee85a 100644
--- a/src/endorse-combobox-delegate.hpp
+++ b/src/endorse-combobox-delegate.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
diff --git a/src/endorse-extension.cpp b/src/endorse-extension.cpp
index 0c9f6c4..37b82d6 100644
--- a/src/endorse-extension.cpp
+++ b/src/endorse-extension.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -79,14 +79,14 @@
   //
 
   if (m_wire.type() != tlv::EndorseExtension)
-    throw Error("Unexpected TLV number when decoding endorse extension packet");
+    NDN_THROW(Error("Unexpected TLV number when decoding endorse extension packet"));
 
   // EntryData
   Block::element_const_iterator i = m_wire.elements_begin();
   if (i == m_wire.elements_end())
-    throw Error("Missing Entry Data");
+    NDN_THROW(Error("Missing Entry Data"));
   if (i->type() != tlv::EntryData)
-    throw Error("Expect Entry Data but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Entry Data but get TLV Type " + std::to_string(i->type())));
 
    while (i != m_wire.elements_end() && i->type() == tlv::EntryData) {
      m_entries.push_back(std::string(reinterpret_cast<const char* >(i->value()),
@@ -94,9 +94,8 @@
      ++i;
   }
 
-  if (i != m_wire.elements_end()) {
-    throw Error("Unexpected element");
-  }
+  if (i != m_wire.elements_end())
+    NDN_THROW(Error("Unexpected element"));
 }
 
 void
diff --git a/src/endorse-extension.hpp b/src/endorse-extension.hpp
index c8bd11e..56827e0 100644
--- a/src/endorse-extension.hpp
+++ b/src/endorse-extension.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -75,4 +75,4 @@
 
 } // namespace chronochat
 
-#endif //CHRONOCHAT_ENDORSE_EXTENSION_HPP
+#endif // CHRONOCHAT_ENDORSE_EXTENSION_HPP
diff --git a/src/endorse-info.cpp b/src/endorse-info.cpp
index 1aa9385..7efdfce 100644
--- a/src/endorse-info.cpp
+++ b/src/endorse-info.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -101,14 +101,14 @@
   m_endorsements.clear();
 
   if (m_wire.type() != tlv::EndorseInfo)
-    throw Error("Unexpected TLV number when decoding endorse info packet");
+    NDN_THROW(Error("Unexpected TLV number when decoding endorse info packet"));
 
   // Endorsement
   Block::element_const_iterator i = m_wire.elements_begin();
   if (i == m_wire.elements_end())
-    throw Error("Missing Endorsement");
+    NDN_THROW(Error("Missing Endorsement"));
   if (i->type() != tlv::Endorsement)
-    throw Error("Expect Endorsement but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Endorsement but get TLV Type " + std::to_string(i->type())));
 
   while (i != m_wire.elements_end() && i->type() == tlv::Endorsement) {
     Endorsement endorsement;
@@ -118,9 +118,9 @@
 
     // Endorse Type
     if (j == temp.elements_end())
-      throw Error("Missing Endorse Type");
+      NDN_THROW(Error("Missing Endorse Type"));
     if (j->type() != tlv::EndorseType)
-      throw Error("Expect Endorse Type but get TLV Type " + std::to_string(j->type()));
+      NDN_THROW(Error("Expect Endorse Type but get TLV Type " + std::to_string(j->type())));
 
     endorsement.type = std::string(reinterpret_cast<const char* >(j->value()),
                                    j->value_size());;
@@ -128,9 +128,9 @@
 
     // Endorse Value
     if (j == temp.elements_end())
-      throw Error("Missing Endorse Value");
+      NDN_THROW(Error("Missing Endorse Value"));
     if (j->type() != tlv::EndorseValue)
-      throw Error("Expect Endorse Value but get TLV Type " + std::to_string(j->type()));
+      NDN_THROW(Error("Expect Endorse Value but get TLV Type " + std::to_string(j->type())));
 
     endorsement.value = std::string(reinterpret_cast<const char* >(j->value()),
                                     j->value_size());
@@ -138,23 +138,22 @@
 
     // Endorse Count
     if (j == temp.elements_end())
-      throw Error("Missing Endorse Count");
+      NDN_THROW(Error("Missing Endorse Count"));
     if (j->type() != tlv::EndorseCount)
-      throw Error("Expect Endorse Count but get TLV Type " + std::to_string(j->type()));
+      NDN_THROW(Error("Expect Endorse Count but get TLV Type " + std::to_string(j->type())));
 
     endorsement.count = std::string(reinterpret_cast<const char* >(j->value()),
                                     j->value_size());
     ++j;
-    if (j != temp.elements_end()) {
-      throw Error("Unexpected element");
-    }
+    if (j != temp.elements_end())
+      NDN_THROW(Error("Unexpected element"));
+
     m_endorsements.push_back(endorsement);
     ++i;
   }
 
-  if (i != m_wire.elements_end()) {
-      throw Error("Unexpected element");
-  }
+  if (i != m_wire.elements_end())
+      NDN_THROW(Error("Unexpected element"));
 }
 
 void
diff --git a/src/endorse-info.hpp b/src/endorse-info.hpp
index a794c63..a265dd9 100644
--- a/src/endorse-info.hpp
+++ b/src/endorse-info.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -33,7 +33,8 @@
     }
   };
 
-  class Endorsement {
+  class Endorsement
+  {
   public:
     std::string type;
     std::string value;
@@ -78,4 +79,4 @@
 
 } // namespace chronochat
 
-#endif //CHRONOCHAT_ENDORSE_INFO_HPP
+#endif // CHRONOCHAT_ENDORSE_INFO_HPP
diff --git a/src/invitation-dialog.cpp b/src/invitation-dialog.cpp
index aac02e0..b7a4725 100644
--- a/src/invitation-dialog.cpp
+++ b/src/invitation-dialog.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -65,5 +65,4 @@
 
 #if WAF
 #include "invitation-dialog.moc"
-// #include "invitation-dialog.cpp.moc"
 #endif
diff --git a/src/invitation-dialog.hpp b/src/invitation-dialog.hpp
index 030cec8..8a0f2ee 100644
--- a/src/invitation-dialog.hpp
+++ b/src/invitation-dialog.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -11,15 +11,12 @@
 #ifndef CHRONOCHAT_INVITATION_DIALOG_HPP
 #define CHRONOCHAT_INVITATION_DIALOG_HPP
 
-#include <QDialog>
-
-#ifndef Q_MOC_RUN
 #include "common.hpp"
-#endif
+#include <QDialog>
 
 namespace Ui {
 class InvitationDialog;
-}
+} // namespace Ui
 
 namespace chronochat {
 
diff --git a/src/invitation-request-dialog.cpp b/src/invitation-request-dialog.cpp
index 47b63f1..15a6726 100644
--- a/src/invitation-request-dialog.cpp
+++ b/src/invitation-request-dialog.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -67,5 +67,4 @@
 
 #if WAF
 #include "invitation-request-dialog.moc"
-// #include "invitation-request-dialog.cpp.moc"
 #endif
diff --git a/src/invitation-request-dialog.hpp b/src/invitation-request-dialog.hpp
index c15fce2..6441b4b 100644
--- a/src/invitation-request-dialog.hpp
+++ b/src/invitation-request-dialog.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -11,17 +11,14 @@
 #ifndef CHRONOCHAT_INVITATION_REQUEST_DIALOG_HPP
 #define CHRONOCHAT_INVITATION_REQUEST_DIALOG_HPP
 
-#include <QDialog>
-
-#ifndef Q_MOC_RUN
 #include "common.hpp"
-#endif
+#include <QDialog>
 
 namespace Ui {
 class InvitationRequestDialog;
-}
+} // namespace Ui
 
-namespace chronochat{
+namespace chronochat {
 
 class InvitationRequestDialog : public QDialog
 {
diff --git a/src/invitation.cpp b/src/invitation.cpp
index e7d2ac5..9af3c4d 100644
--- a/src/invitation.cpp
+++ b/src/invitation.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -12,8 +12,6 @@
 
 #include <ndn-cxx/security/signature-sha256-with-rsa.hpp>
 
-#include "logging.h"
-
 namespace chronochat {
 
 using std::string;
@@ -35,10 +33,10 @@
   size_t nameSize = interestName.size();
 
   if (nameSize < NAME_SIZE_MIN)
-    throw Error("Wrong Invitation Name: Wrong length");
+    NDN_THROW(Error("Wrong Invitation Name: Wrong length"));
 
   if (interestName.get(CHRONOCHAT_INVITATION).toUri() != "CHRONOCHAT-INVITATION")
-    throw Error("Wrong Invitation Name: Wrong application tags");
+    NDN_THROW(Error("Wrong Invitation Name: Wrong application tags"));
 
   m_interestName = interestName.getPrefix(KEY_LOCATOR);
   m_timestamp = interestName.get(TIMESTAMP).toNumber();
diff --git a/src/invitation.hpp b/src/invitation.hpp
index c9d3731..133a3aa 100644
--- a/src/invitation.hpp
+++ b/src/invitation.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -91,7 +91,7 @@
     return m_inviterCertificate;
   }
 
-  const uint64_t
+  uint64_t
   getTimestamp() const
   {
     return m_timestamp;
diff --git a/src/invite-list-dialog.cpp b/src/invite-list-dialog.cpp
index 435e2f6..23af0c9 100644
--- a/src/invite-list-dialog.cpp
+++ b/src/invite-list-dialog.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -82,5 +82,4 @@
 
 #if WAF
 #include "invite-list-dialog.moc"
-// #include "invite-list-dialog.cpp.moc"
 #endif
diff --git a/src/invite-list-dialog.hpp b/src/invite-list-dialog.hpp
index e5e8fd3..ee2561c 100644
--- a/src/invite-list-dialog.hpp
+++ b/src/invite-list-dialog.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -14,12 +14,9 @@
 #include <QDialog>
 #include <QStringListModel>
 
-#ifndef Q_MOC_RUN
-#endif
-
 namespace Ui {
 class InviteListDialog;
-}
+} // namespace Ui
 
 namespace chronochat {
 
diff --git a/src/main.cpp b/src/main.cpp
index 90f1d9d..039fa42 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -8,10 +8,11 @@
  * Author: Yingdi Yu <yingdi@cs.ucla.edu>
  */
 
+#include "controller.hpp"
+
 #include <QApplication>
 #include <QTextCodec>
 
-#include "controller.hpp"
 #include <iostream>
 #include <ndn-cxx/face.hpp>
 #include <boost/thread/thread.hpp>
@@ -28,9 +29,9 @@
   notify(QObject* receiver, QEvent* event)
   {
     try {
-        return QApplication::notify(receiver, event);
+      return QApplication::notify(receiver, event);
     }
-    catch (std::exception& e) {
+    catch (const std::exception& e) {
       std::cerr << "Exception thrown:" << e.what() << std::endl;
       return false;
     }
diff --git a/src/nfd-connection-checker.cpp b/src/nfd-connection-checker.cpp
index eda7197..e349b92 100644
--- a/src/nfd-connection-checker.cpp
+++ b/src/nfd-connection-checker.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -9,10 +9,6 @@
 
 #include "nfd-connection-checker.hpp"
 
-#ifndef Q_MOC_RUN
-
-#endif
-
 namespace chronochat {
 
 static const int CONNECTION_RETRY_TIMER = 2;
@@ -38,7 +34,9 @@
       m_nfdConnected = true;
     }
     try {
-      m_face->expressInterest(Interest("/localhost/nfd/status"),
+      Interest interest("/localhost/nfd/status");
+      interest.setCanBePrefix(true);
+      m_face->expressInterest(interest,
                               [&] (const Interest& interest, const Data& data) {
                                 m_face->shutdown();
                               },
@@ -46,7 +44,7 @@
                               [] (const Interest& interest) {});
       m_face->processEvents(time::milliseconds::zero(), true);
     }
-    catch (std::runtime_error& e) {
+    catch (const std::runtime_error& e) {
       {
         std::lock_guard<std::mutex>lock(m_nfdMutex);
         m_nfdConnected = false;
@@ -73,5 +71,4 @@
 
 #if WAF
 #include "nfd-connection-checker.moc"
-// #include "nfd-connection-checker.cpp.moc"
 #endif
diff --git a/src/nfd-connection-checker.hpp b/src/nfd-connection-checker.hpp
index 08b6085..75784f7 100644
--- a/src/nfd-connection-checker.hpp
+++ b/src/nfd-connection-checker.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *
  * BSD license, See the LICENSE file for more information
  *
@@ -10,14 +10,12 @@
 #ifndef CHRONOCHAT_NFD_CONNECTION_CHECKER_HPP
 #define CHRONOCHAT_NFD_CONNECTION_CHECKER_HPP
 
-#include <QThread>
-
-#ifndef Q_MOC_RUN
 #include "common.hpp"
+
+#include <QThread>
 #include <mutex>
 #include <boost/thread.hpp>
 #include <ndn-cxx/face.hpp>
-#endif
 
 namespace chronochat {
 
diff --git a/src/profile-editor.cpp b/src/profile-editor.cpp
index f0b067d..fbfe105 100644
--- a/src/profile-editor.cpp
+++ b/src/profile-editor.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -14,12 +14,6 @@
 #include <QtSql/QSqlField>
 #include <QtSql/QSqlError>
 
-#ifndef Q_MOC_RUN
-#include "logging.h"
-#endif
-
-// INIT_LOGGER("ProfileEditor")
-
 namespace chronochat {
 
 ProfileEditor::ProfileEditor(QWidget *parent)
@@ -40,9 +34,7 @@
 ProfileEditor::~ProfileEditor()
 {
     delete ui;
-
-    if (m_tableModel)
-      delete m_tableModel;
+    delete m_tableModel;
 }
 
 void
@@ -109,5 +101,4 @@
 
 #if WAF
 #include "profile-editor.moc"
-// #include "profile-editor.cpp.moc"
 #endif
diff --git a/src/profile-editor.hpp b/src/profile-editor.hpp
index a18f8fc..01d5f57 100644
--- a/src/profile-editor.hpp
+++ b/src/profile-editor.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -14,12 +14,9 @@
 #include <QDialog>
 #include <QtSql/QSqlTableModel>
 
-#ifndef Q_MOC_RUN
-#endif
-
 namespace Ui {
 class ProfileEditor;
-}
+} // namespace Ui
 
 namespace chronochat {
 
@@ -58,7 +55,7 @@
 
 private:
   Ui::ProfileEditor* ui;
-  QSqlTableModel* m_tableModel;
+  QSqlTableModel* m_tableModel = 0;
   QString m_identity;
 };
 
diff --git a/src/profile.cpp b/src/profile.cpp
index dc89fa9..06cb1e5 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -10,7 +10,6 @@
  */
 
 #include "profile.hpp"
-#include "logging.h"
 #include <ndn-cxx/security/additional-description.hpp>
 
 namespace chronochat {
@@ -149,45 +148,43 @@
   m_wire.parse();
 
   if (m_wire.type() != tlv::Profile)
-    throw Error("Unexpected TLV number when decoding profile packet");
+    NDN_THROW(Error("Unexpected TLV number when decoding profile packet"));
 
   Block::element_const_iterator i = m_wire.elements_begin();
   if (i == m_wire.elements_end())
-    throw Error("Missing Profile Entry");
+    NDN_THROW(Error("Missing Profile Entry"));
   if (i->type() != tlv::ProfileEntry)
-    throw Error("Expect Profile Entry but get TLV Type " + std::to_string(i->type()));
+    NDN_THROW(Error("Expect Profile Entry but get TLV Type " + std::to_string(i->type())));
 
   while (i != m_wire.elements_end() && i->type() == tlv::ProfileEntry) {
     Block temp = *i;
     temp.parse();
     Block::element_const_iterator j = temp.elements_begin();
     if (j == temp.elements_end())
-      throw Error("Missing Oid");
+      NDN_THROW(Error("Missing Oid"));
     if (j->type() != tlv::Oid)
-      throw Error("Expect Oid but get TLV Type" + std::to_string(j->type()));
+      NDN_THROW(Error("Expect Oid but get TLV Type" + std::to_string(j->type())));
 
     string Oid = std::string(reinterpret_cast<const char* >(j->value()),
                              j->value_size());
     ++j;
     if (j == temp.elements_end())
-      throw Error("Missing EntryData");
+      NDN_THROW(Error("Missing EntryData"));
     if (j->type() != tlv::EntryData)
-      throw Error("Expect EntryData but get TLV Type " + std::to_string(j->type()));
+      NDN_THROW(Error("Expect EntryData but get TLV Type " + std::to_string(j->type())));
 
     string EntryData = std::string(reinterpret_cast<const char* >(j->value()),
                                    j->value_size());
     ++j;
-    if (j != temp.elements_end()) {
-      throw Error("Unexpected element");
-    }
+    if (j != temp.elements_end())
+      NDN_THROW(Error("Unexpected element"));
+
     m_entries[Oid] = EntryData;
     ++i;
   }
 
-  if (i != m_wire.elements_end()) {
-      throw Error("Unexpected element");
-  }
-
+  if (i != m_wire.elements_end())
+      NDN_THROW(Error("Unexpected element"));
 }
 
 bool
diff --git a/src/profile.hpp b/src/profile.hpp
index 43dba96..6692127 100644
--- a/src/profile.hpp
+++ b/src/profile.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -40,9 +40,7 @@
   typedef std::map<std::string, std::string>::iterator iterator;
   typedef std::map<std::string, std::string>::const_iterator const_iterator;
 
-  Profile()
-  {
-  }
+  Profile() = default;
 
   Profile(const ndn::security::Certificate& identityCertificate);
 
@@ -56,9 +54,8 @@
 
   Profile(const Block& profileWire);
 
-  ~Profile()
-  {
-  }
+  Profile&
+  operator=(const Profile&) = default;
 
   const Block&
   wireEncode() const;
diff --git a/src/set-alias-dialog.cpp b/src/set-alias-dialog.cpp
index ae75a2b..d241e58 100644
--- a/src/set-alias-dialog.cpp
+++ b/src/set-alias-dialog.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -56,5 +56,4 @@
 
 #if WAF
 #include "set-alias-dialog.moc"
-// #include "set-alias-dialog.cpp.moc"
 #endif
diff --git a/src/set-alias-dialog.hpp b/src/set-alias-dialog.hpp
index 7ae2438..e044bab 100644
--- a/src/set-alias-dialog.hpp
+++ b/src/set-alias-dialog.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -19,7 +19,7 @@
 
 namespace Ui {
 class SetAliasDialog;
-}
+} // namespace Ui
 
 namespace chronochat {
 
diff --git a/src/setting-dialog.cpp b/src/setting-dialog.cpp
index 9f38cac..18dd460 100644
--- a/src/setting-dialog.cpp
+++ b/src/setting-dialog.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -85,5 +85,4 @@
 
 #if WAF
 #include "setting-dialog.moc"
-// #include "setting-dialog.cpp.moc"
 #endif
diff --git a/src/setting-dialog.hpp b/src/setting-dialog.hpp
index a8cef6c..5b6ad11 100644
--- a/src/setting-dialog.hpp
+++ b/src/setting-dialog.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -13,12 +13,9 @@
 
 #include <QDialog>
 
-#ifndef Q_MOC_RUN
-#endif
-
 namespace Ui {
 class SettingDialog;
-}
+} // namespace Ui
 
 namespace chronochat {
 
diff --git a/src/start-chat-dialog.cpp b/src/start-chat-dialog.cpp
index d3949e5..160275f 100644
--- a/src/start-chat-dialog.cpp
+++ b/src/start-chat-dialog.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -56,5 +56,4 @@
 
 #if WAF
 #include "start-chat-dialog.moc"
-// #include "start-chat-dialog.cpp.moc"
 #endif
diff --git a/src/start-chat-dialog.hpp b/src/start-chat-dialog.hpp
index d0439d7..7af4994 100644
--- a/src/start-chat-dialog.hpp
+++ b/src/start-chat-dialog.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -19,7 +19,7 @@
 
 namespace Ui {
 class StartChatDialog;
-}
+} // namespace Ui
 
 namespace chronochat {
 
diff --git a/src/tree-layout.cpp b/src/tree-layout.cpp
index 9bf3627..6df61ad 100644
--- a/src/tree-layout.cpp
+++ b/src/tree-layout.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
diff --git a/src/tree-layout.hpp b/src/tree-layout.hpp
index 514b1ed..b180b83 100644
--- a/src/tree-layout.hpp
+++ b/src/tree-layout.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
diff --git a/src/trust-tree-node.hpp b/src/trust-tree-node.hpp
index dc38894..cb275b2 100644
--- a/src/trust-tree-node.hpp
+++ b/src/trust-tree-node.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
diff --git a/src/trust-tree-scene.cpp b/src/trust-tree-scene.cpp
index 3a23718..58e9861 100644
--- a/src/trust-tree-scene.cpp
+++ b/src/trust-tree-scene.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -104,9 +104,8 @@
   }
 }
 
-} //namespace chronochat
+} // namespace chronochat
 
 #if WAF
 #include "trust-tree-scene.moc"
-// #include "trust-tree-scene.cpp.moc"
 #endif
diff --git a/src/trust-tree-scene.hpp b/src/trust-tree-scene.hpp
index 0412914..1d4d0e1 100644
--- a/src/trust-tree-scene.hpp
+++ b/src/trust-tree-scene.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013, Regents of the University of California
+ * Copyright (c) 2020, Regents of the University of California
  *                     Yingdi Yu
  *
  * BSD license, See the LICENSE file for more information
@@ -11,15 +11,15 @@
 #ifndef CHRONOCHAT_TRUST_TREE_SCENE_HPP
 #define CHRONOCHAT_TRUST_TREE_SCENE_HPP
 
-#include <QGraphicsScene>
-#include <QColor>
-#include <QMap>
-
 #ifndef Q_MOC_RUN
 #include "trust-tree-node.hpp"
 #include "tree-layout.hpp"
 #endif
 
+#include <QGraphicsScene>
+#include <QColor>
+#include <QMap>
+
 class QGraphicsTextItem;
 
 namespace chronochat {