diff --git a/examples/consumer-with-timer.cpp b/examples/consumer-with-timer.cpp
index 04c6037..b3b35ee 100644
--- a/examples/consumer-with-timer.cpp
+++ b/examples/consumer-with-timer.cpp
@@ -29,7 +29,7 @@
 
 // Enclosing code in ndn simplifies coding (can also use `using namespace ndn`)
 namespace ndn {
-// Additional nested namespaces can be used to prevent/limit name conflicts
+// Additional nested namespaces should be used to prevent/limit name conflicts
 namespace examples {
 
 class ConsumerWithTimer
@@ -44,17 +44,20 @@
   void
   run()
   {
-    Interest interest(Name("/example/testApp/randomData"));
-    interest.setInterestLifetime(2_s); // 2 seconds
-    interest.setMustBeFresh(true);
+    Name interestName("/example/testApp/randomData");
+    interestName.appendVersion();
 
+    Interest interest(interestName);
+    interest.setCanBePrefix(false);
+    interest.setMustBeFresh(true);
+    interest.setInterestLifetime(2_s);
+
+    std::cout << "Sending Interest " << interest << std::endl;
     m_face.expressInterest(interest,
                            bind(&ConsumerWithTimer::onData, this, _1, _2),
                            bind(&ConsumerWithTimer::onNack, this, _1, _2),
                            bind(&ConsumerWithTimer::onTimeout, this, _1));
 
-    std::cout << "Sending " << interest << std::endl;
-
     // Schedule a new event
     m_scheduler.schedule(3_s, [this] { delayedInterest(); });
 
@@ -68,22 +71,22 @@
 
 private:
   void
-  onData(const Interest& interest, const Data& data)
+  onData(const Interest&, const Data& data) const
   {
-    std::cout << data << std::endl;
+    std::cout << "Received Data " << data << std::endl;
   }
 
   void
-  onNack(const Interest& interest, const lp::Nack& nack)
+  onNack(const Interest& interest, const lp::Nack& nack) const
   {
-    std::cout << "received Nack with reason " << nack.getReason()
-              << " for interest " << interest << std::endl;
+    std::cout << "Received Nack with reason " << nack.getReason()
+              << " for " << interest << std::endl;
   }
 
   void
-  onTimeout(const Interest& interest)
+  onTimeout(const Interest& interest) const
   {
-    std::cout << "Timeout " << interest << std::endl;
+    std::cout << "Timeout for " << interest << std::endl;
   }
 
   void
@@ -91,20 +94,23 @@
   {
     std::cout << "One more Interest, delayed by the scheduler" << std::endl;
 
-    Interest interest(Name("/example/testApp/randomData"));
-    interest.setInterestLifetime(2_s); // 2 seconds
-    interest.setMustBeFresh(true);
+    Name interestName("/example/testApp/randomData");
+    interestName.appendVersion();
 
+    Interest interest(interestName);
+    interest.setCanBePrefix(false);
+    interest.setMustBeFresh(true);
+    interest.setInterestLifetime(2_s);
+
+    std::cout << "Sending Interest " << interest << std::endl;
     m_face.expressInterest(interest,
                            bind(&ConsumerWithTimer::onData, this, _1, _2),
                            bind(&ConsumerWithTimer::onNack, this, _1, _2),
                            bind(&ConsumerWithTimer::onTimeout, this, _1));
-
-    std::cout << "Sending " << interest << std::endl;
   }
 
 private:
-  // Explicitly create io_service object, which can be shared between Face and Scheduler
+  // Explicitly create io_service object, which will be shared between Face and Scheduler
   boost::asio::io_service m_ioService;
   Face m_face;
   Scheduler m_scheduler;
@@ -116,12 +122,13 @@
 int
 main(int argc, char** argv)
 {
-  ndn::examples::ConsumerWithTimer consumer;
   try {
+    ndn::examples::ConsumerWithTimer consumer;
     consumer.run();
+    return 0;
   }
   catch (const std::exception& e) {
     std::cerr << "ERROR: " << e.what() << std::endl;
+    return 1;
   }
-  return 0;
 }
diff --git a/examples/consumer.cpp b/examples/consumer.cpp
index f06ac07..ef6cd76 100644
--- a/examples/consumer.cpp
+++ b/examples/consumer.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2019 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -27,48 +27,50 @@
 
 // Enclosing code in ndn simplifies coding (can also use `using namespace ndn`)
 namespace ndn {
-// Additional nested namespaces can be used to prevent/limit name conflicts
+// Additional nested namespaces should be used to prevent/limit name conflicts
 namespace examples {
 
-class Consumer : noncopyable
+class Consumer
 {
 public:
   void
   run()
   {
-    Interest interest(Name("/example/testApp/randomData"));
-    interest.setInterestLifetime(2_s); // 2 seconds
-    interest.setMustBeFresh(true);
+    Name interestName("/example/testApp/randomData");
+    interestName.appendVersion();
 
+    Interest interest(interestName);
+    interest.setCanBePrefix(false);
+    interest.setMustBeFresh(true);
+    interest.setInterestLifetime(6_s); // The default is 4 seconds
+
+    std::cout << "Sending Interest " << interest << std::endl;
     m_face.expressInterest(interest,
                            bind(&Consumer::onData, this,  _1, _2),
                            bind(&Consumer::onNack, this, _1, _2),
                            bind(&Consumer::onTimeout, this, _1));
 
-    std::cout << "Sending " << interest << std::endl;
-
-    // processEvents will block until the requested data received or timeout occurs
+    // processEvents will block until the requested data is received or a timeout occurs
     m_face.processEvents();
   }
 
 private:
   void
-  onData(const Interest& interest, const Data& data)
+  onData(const Interest&, const Data& data) const
   {
-    std::cout << data << std::endl;
+    std::cout << "Received Data " << data << std::endl;
   }
 
   void
-  onNack(const Interest& interest, const lp::Nack& nack)
+  onNack(const Interest&, const lp::Nack& nack) const
   {
-    std::cout << "received Nack with reason " << nack.getReason()
-              << " for interest " << interest << std::endl;
+    std::cout << "Received Nack with reason " << nack.getReason() << std::endl;
   }
 
   void
-  onTimeout(const Interest& interest)
+  onTimeout(const Interest& interest) const
   {
-    std::cout << "Timeout " << interest << std::endl;
+    std::cout << "Timeout for " << interest << std::endl;
   }
 
 private:
@@ -81,12 +83,13 @@
 int
 main(int argc, char** argv)
 {
-  ndn::examples::Consumer consumer;
   try {
+    ndn::examples::Consumer consumer;
     consumer.run();
+    return 0;
   }
   catch (const std::exception& e) {
     std::cerr << "ERROR: " << e.what() << std::endl;
+    return 1;
   }
-  return 0;
 }
diff --git a/examples/producer.cpp b/examples/producer.cpp
index 4544ec0..516e1c0 100644
--- a/examples/producer.cpp
+++ b/examples/producer.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2019 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,15 +23,16 @@
 
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/security/signing-helpers.hpp>
 
 #include <iostream>
 
 // Enclosing code in ndn simplifies coding (can also use `using namespace ndn`)
 namespace ndn {
-// Additional nested namespaces can be used to prevent/limit name conflicts
+// Additional nested namespaces should be used to prevent/limit name conflicts
 namespace examples {
 
-class Producer : noncopyable
+class Producer
 {
 public:
   void
@@ -39,48 +40,41 @@
   {
     m_face.setInterestFilter("/example/testApp",
                              bind(&Producer::onInterest, this, _1, _2),
-                             RegisterPrefixSuccessCallback(),
+                             nullptr, // RegisterPrefixSuccessCallback is optional
                              bind(&Producer::onRegisterFailed, this, _1, _2));
     m_face.processEvents();
   }
 
 private:
   void
-  onInterest(const InterestFilter& filter, const Interest& interest)
+  onInterest(const InterestFilter&, const Interest& interest)
   {
-    std::cout << "<< I: " << interest << std::endl;
+    std::cout << ">> I: " << interest << std::endl;
 
-    // Create new name, based on Interest's name
-    Name dataName(interest.getName());
-    dataName
-      .append("testApp") // add "testApp" component to Interest name
-      .appendVersion();  // add "version" component (current UNIX timestamp in milliseconds)
-
-    static const std::string content = "HELLO KITTY";
+    static const std::string content("Hello, world!");
 
     // Create Data packet
-    shared_ptr<Data> data = make_shared<Data>();
-    data->setName(dataName);
-    data->setFreshnessPeriod(10_s); // 10 seconds
+    auto data = make_shared<Data>(interest.getName());
+    data->setFreshnessPeriod(10_s);
     data->setContent(reinterpret_cast<const uint8_t*>(content.data()), content.size());
 
     // Sign Data packet with default identity
     m_keyChain.sign(*data);
-    // m_keyChain.sign(data, <identityName>);
-    // m_keyChain.sign(data, <certificate>);
+    // m_keyChain.sign(*data, signingByIdentity(<identityName>));
+    // m_keyChain.sign(*data, signingByKey(<keyName>));
+    // m_keyChain.sign(*data, signingByCertificate(<certName>));
+    // m_keyChain.sign(*data, signingWithSha256());
 
     // Return Data packet to the requester
-    std::cout << ">> D: " << *data << std::endl;
+    std::cout << "<< D: " << *data << std::endl;
     m_face.put(*data);
   }
 
-
   void
   onRegisterFailed(const Name& prefix, const std::string& reason)
   {
-    std::cerr << "ERROR: Failed to register prefix \""
-              << prefix << "\" in local hub's daemon (" << reason << ")"
-              << std::endl;
+    std::cerr << "ERROR: Failed to register prefix '" << prefix
+              << "' with the local forwarder (" << reason << ")" << std::endl;
     m_face.shutdown();
   }
 
@@ -95,12 +89,13 @@
 int
 main(int argc, char** argv)
 {
-  ndn::examples::Producer producer;
   try {
+    ndn::examples::Producer producer;
     producer.run();
+    return 0;
   }
   catch (const std::exception& e) {
     std::cerr << "ERROR: " << e.what() << std::endl;
+    return 1;
   }
-  return 0;
 }
