diff --git a/tools/chunks/catchunks/main.cpp b/tools/chunks/catchunks/main.cpp
index 82d10c8..c7deb5c 100644
--- a/tools/chunks/catchunks/main.cpp
+++ b/tools/chunks/catchunks/main.cpp
@@ -58,7 +58,7 @@
        ignoreCongMarks(false), enableFastConv(false);
   int initCwnd(1), initSsthresh(std::numeric_limits<int>::max()), k(8);
   double aiStep(1.0), rtoAlpha(0.125), rtoBeta(0.25), aimdBeta(0.5), cubicBeta(0.7);
-  int64_t minRto(200), maxRto(60000);
+  time::milliseconds::rep minRto(200), maxRto(60000);
   std::string cwndPath, rttPath;
 
   namespace po = boost::program_options;
@@ -68,7 +68,7 @@
     ("pipeline-type,p", po::value<std::string>(&pipelineType)->default_value(pipelineType),
                         "type of Interest pipeline to use; valid values are: 'fixed', 'aimd', 'cubic'")
     ("fresh,f",     po::bool_switch(&options.mustBeFresh), "only return fresh content")
-    ("lifetime,l",  po::value<int64_t>()->default_value(options.interestLifetime.count()),
+    ("lifetime,l",  po::value<time::milliseconds::rep>()->default_value(options.interestLifetime.count()),
                     "lifetime of expressed Interests, in milliseconds")
     ("retries,r",   po::value<int>(&options.maxRetriesOnTimeoutOrNack)->default_value(options.maxRetriesOnTimeoutOrNack),
                     "maximum number of retries in case of Nack or timeout (-1 = no limit)")
@@ -107,10 +107,10 @@
                   "beta value for RTO calculation")
     ("rto-k",     po::value<int>(&k)->default_value(k),
                   "k value for RTO calculation")
-    ("min-rto",   po::value<int64_t>(&minRto)->default_value(minRto),
-                  "minimum RTO value in milliseconds")
-    ("max-rto",   po::value<int64_t>(&maxRto)->default_value(maxRto),
-                  "maximum RTO value in milliseconds")
+    ("min-rto",   po::value<time::milliseconds::rep>(&minRto)->default_value(minRto),
+                  "minimum RTO value, in milliseconds")
+    ("max-rto",   po::value<time::milliseconds::rep>(&maxRto)->default_value(maxRto),
+                  "maximum RTO value, in milliseconds")
     ("log-cwnd",  po::value<std::string>(&cwndPath), "log file for congestion window stats")
     ("log-rtt",   po::value<std::string>(&rttPath), "log file for round-trip time stats")
     ;
@@ -179,11 +179,11 @@
     return 2;
   }
 
-  if (vm["lifetime"].as<int64_t>() < 0) {
+  options.interestLifetime = time::milliseconds(vm["lifetime"].as<time::milliseconds::rep>());
+  if (options.interestLifetime < 0_ms) {
     std::cerr << "ERROR: lifetime cannot be negative" << std::endl;
     return 2;
   }
-  options.interestLifetime = time::milliseconds(vm["lifetime"].as<int64_t>());
 
   if (options.isQuiet && options.isVerbose) {
     std::cerr << "ERROR: cannot be quiet and verbose at the same time" << std::endl;
diff --git a/tools/chunks/catchunks/options.hpp b/tools/chunks/catchunks/options.hpp
index d3a564e..9400fb6 100644
--- a/tools/chunks/catchunks/options.hpp
+++ b/tools/chunks/catchunks/options.hpp
@@ -35,7 +35,7 @@
 
 struct Options
 {
-  time::milliseconds interestLifetime = ndn::DEFAULT_INTEREST_LIFETIME;
+  time::milliseconds interestLifetime = DEFAULT_INTEREST_LIFETIME;
   int maxRetriesOnTimeoutOrNack = 15;
   bool mustBeFresh = false;
   bool isQuiet = false;
diff --git a/tools/chunks/putchunks/main.cpp b/tools/chunks/putchunks/main.cpp
index c92182e..5e1dd9f 100644
--- a/tools/chunks/putchunks/main.cpp
+++ b/tools/chunks/putchunks/main.cpp
@@ -109,7 +109,7 @@
   }
 
   opts.freshnessPeriod = time::milliseconds(vm["freshness"].as<time::milliseconds::rep>());
-  if (opts.freshnessPeriod < time::milliseconds::zero()) {
+  if (opts.freshnessPeriod < 0_ms) {
     std::cerr << "ERROR: FreshnessPeriod cannot be negative" << std::endl;
     return 2;
   }
diff --git a/tools/peek/ndnpeek/main.cpp b/tools/peek/ndnpeek/main.cpp
index ead3d70..70977aa 100644
--- a/tools/peek/ndnpeek/main.cpp
+++ b/tools/peek/ndnpeek/main.cpp
@@ -54,8 +54,9 @@
   po::options_description genericOptDesc("Generic options");
   genericOptDesc.add_options()
     ("help,h",    "print help and exit")
-    ("payload,p", po::bool_switch(&options.wantPayloadOnly), "print payload only, instead of full packet")
-    ("timeout,w", po::value<int>(), "set timeout (in milliseconds)")
+    ("payload,p", po::bool_switch(&options.wantPayloadOnly),
+                  "print payload only, instead of full packet")
+    ("timeout,w", po::value<time::milliseconds::rep>(), "execution timeout, in milliseconds")
     ("verbose,v", po::bool_switch(&options.isVerbose), "turn on verbose output")
     ("version,V", "print version and exit")
   ;
@@ -65,7 +66,8 @@
     ("prefix,P",   po::bool_switch(&options.canBePrefix), "set CanBePrefix")
     ("fresh,f",    po::bool_switch(&options.mustBeFresh), "set MustBeFresh")
     ("link-file",  po::value<std::string>(), "set ForwardingHint from a file")
-    ("lifetime,l", po::value<int>(), "set InterestLifetime (in milliseconds)")
+    ("lifetime,l", po::value<time::milliseconds::rep>()->default_value(options.interestLifetime.count()),
+                   "set InterestLifetime, in milliseconds")
   ;
 
   po::options_description visibleOptDesc;
@@ -115,21 +117,15 @@
     return 2;
   }
 
-  if (vm.count("lifetime") > 0) {
-    if (vm["lifetime"].as<int>() >= 0) {
-      options.interestLifetime = time::milliseconds(vm["lifetime"].as<int>());
-    }
-    else {
-      std::cerr << "ERROR: lifetime cannot be negative" << std::endl;
-      return 2;
-    }
+  options.interestLifetime = time::milliseconds(vm["lifetime"].as<time::milliseconds::rep>());
+  if (options.interestLifetime < 0_ms) {
+    std::cerr << "ERROR: lifetime cannot be negative" << std::endl;
+    return 2;
   }
 
   if (vm.count("timeout") > 0) {
-    if (vm["timeout"].as<int>() >= 0) {
-      options.timeout = time::milliseconds(vm["timeout"].as<int>());
-    }
-    else {
+    options.timeout = time::milliseconds(vm["timeout"].as<time::milliseconds::rep>());
+    if (*options.timeout < 0_ms) {
       std::cerr << "ERROR: timeout cannot be negative" << std::endl;
       return 2;
     }
diff --git a/tools/peek/ndnpeek/ndnpeek.cpp b/tools/peek/ndnpeek/ndnpeek.cpp
index 8969216..ff7f7a0 100644
--- a/tools/peek/ndnpeek/ndnpeek.cpp
+++ b/tools/peek/ndnpeek/ndnpeek.cpp
@@ -62,12 +62,10 @@
   Interest interest(m_options.name);
   interest.setCanBePrefix(m_options.canBePrefix);
   interest.setMustBeFresh(m_options.mustBeFresh);
+  interest.setInterestLifetime(m_options.interestLifetime);
   if (m_options.link) {
     interest.setForwardingHint(m_options.link->getDelegationList());
   }
-  if (m_options.interestLifetime) {
-    interest.setInterestLifetime(*m_options.interestLifetime);
-  }
 
   if (m_options.isVerbose) {
     std::cerr << "INTEREST: " << interest << std::endl;
diff --git a/tools/peek/ndnpeek/ndnpeek.hpp b/tools/peek/ndnpeek/ndnpeek.hpp
index 0a9f503..d02155f 100644
--- a/tools/peek/ndnpeek/ndnpeek.hpp
+++ b/tools/peek/ndnpeek/ndnpeek.hpp
@@ -47,9 +47,9 @@
   bool canBePrefix = false;
   bool mustBeFresh = false;
   shared_ptr<Link> link;
-  optional<time::milliseconds> interestLifetime;
+  time::milliseconds interestLifetime = DEFAULT_INTEREST_LIFETIME;
 
-  // output behavior options
+  // program behavior options
   bool isVerbose = false;
   bool wantPayloadOnly = false;
   optional<time::milliseconds> timeout;
diff --git a/tools/peek/ndnpoke/main.cpp b/tools/peek/ndnpoke/main.cpp
index 913b0a8..4e8713a 100644
--- a/tools/peek/ndnpoke/main.cpp
+++ b/tools/peek/ndnpoke/main.cpp
@@ -55,7 +55,7 @@
     ("help,h",        "print help and exit")
     ("unsolicited,u", po::bool_switch(&options.wantUnsolicited),
                       "send the Data packet without waiting for an incoming Interest")
-    ("timeout,w",     po::value<time::milliseconds::rep>(), "set timeout (in milliseconds)")
+    ("timeout,w",     po::value<time::milliseconds::rep>(), "execution timeout, in milliseconds")
     ("verbose,v",     po::bool_switch(&options.isVerbose), "turn on verbose output")
     ("version,V",     "print version and exit")
   ;
@@ -65,7 +65,7 @@
     ("final,F",     po::bool_switch(&options.wantFinalBlockId),
                     "set FinalBlockId to the last component of the Data name")
     ("freshness,x", po::value<time::milliseconds::rep>()->default_value(options.freshnessPeriod.count()),
-                    "set FreshnessPeriod (in milliseconds)")
+                    "set FreshnessPeriod, in milliseconds")
     ("identity,i",  po::value<std::string>(), "use the specified identity for signing")
     ("digest,D",    po::bool_switch(&wantDigestSha256),
                     "use DigestSha256 signing method instead of SignatureSha256WithRsa")
@@ -134,13 +134,10 @@
     return 2;
   }
 
-  if (vm.count("freshness") > 0) {
-    auto freshness = vm["freshness"].as<time::milliseconds::rep>();
-    if (freshness < 0) {
-      std::cerr << "ERROR: freshness cannot be negative" << std::endl;
-      return 2;
-    }
-    options.freshnessPeriod = time::milliseconds(freshness);
+  options.freshnessPeriod = time::milliseconds(vm["freshness"].as<time::milliseconds::rep>());
+  if (options.freshnessPeriod < 0_ms) {
+    std::cerr << "ERROR: freshness cannot be negative" << std::endl;
+    return 2;
   }
 
   if (vm.count("identity") > 0) {
@@ -166,12 +163,11 @@
       std::cerr << "ERROR: conflicting '--unsolicited' and '--timeout' options specified" << std::endl;
       return 2;
     }
-    auto timeout = vm["timeout"].as<time::milliseconds::rep>();
-    if (timeout < 0) {
+    options.timeout = time::milliseconds(vm["timeout"].as<time::milliseconds::rep>());
+    if (*options.timeout < 0_ms) {
       std::cerr << "ERROR: timeout cannot be negative" << std::endl;
       return 2;
     }
-    options.timeout = time::milliseconds(timeout);
   }
 
   try {
diff --git a/tools/ping/client/main.cpp b/tools/ping/client/main.cpp
index 86db7da..76d72ff 100644
--- a/tools/ping/client/main.cpp
+++ b/tools/ping/client/main.cpp
@@ -160,37 +160,35 @@
 
   namespace po = boost::program_options;
 
-  po::options_description visibleOptDesc("Allowed options");
+  po::options_description visibleOptDesc("Options");
   visibleOptDesc.add_options()
-    ("help,h", "print this message and exit")
-    ("version,V", "display version and exit")
-    ("interval,i", po::value<int>(),
-                   ("set ping interval in milliseconds (default " +
-                   std::to_string(getDefaultPingInterval().count()) + " ms - minimum " +
-                   std::to_string(getMinimumPingInterval().count()) + " ms)").c_str())
-    ("timeout,o", po::value<int>(),
-                  ("set ping timeout in milliseconds (default " +
-                  std::to_string(getDefaultPingTimeoutThreshold().count()) + " ms)").c_str())
-    ("count,c", po::value<int>(&options.nPings), "set total number of pings")
-    ("start,n", po::value<uint64_t>(&options.startSeq),
-                "set the starting seq number, the number is incremented by 1 after each Interest")
+    ("help,h",      "print this message and exit")
+    ("version,V",   "display version and exit")
+    ("interval,i",  po::value<time::milliseconds::rep>()->default_value(getDefaultPingInterval().count()),
+                    "ping interval, in milliseconds")
+    ("timeout,o",   po::value<time::milliseconds::rep>()->default_value(getDefaultPingTimeoutThreshold().count()),
+                    "ping timeout, in milliseconds")
+    ("count,c",     po::value<int>(&options.nPings), "number of pings to send (default = no limit)")
+    ("start,n",     po::value<uint64_t>(&options.startSeq),
+                    "set the starting sequence number, the number is incremented by 1 after each Interest")
     ("identifier,p", po::value<std::string>(&identifier),
-                     "add identifier to the Interest names before the numbers to avoid conflict")
-    ("cache,a", "allows routers to return stale Data from cache")
+                     "add identifier to the Interest names before the sequence numbers to avoid conflicts")
+    ("cache,a",     "allow routers to return stale Data from cache")
     ("timestamp,t", "print timestamp with messages")
   ;
-  po::options_description hiddenOptDesc("Hidden options");
+
+  po::options_description hiddenOptDesc;
   hiddenOptDesc.add_options()
     ("prefix", po::value<std::string>(), "prefix to send pings to")
   ;
 
-  po::options_description optDesc("Allowed options");
+  po::options_description optDesc;
   optDesc.add(visibleOptDesc).add(hiddenOptDesc);
 
-  try {
-    po::positional_options_description optPos;
-    optPos.add("prefix", -1);
+  po::positional_options_description optPos;
+  optPos.add("prefix", -1);
 
+  try {
     po::variables_map optVm;
     po::store(po::command_line_parser(argc, argv).options(optDesc).positional(optPos).run(), optVm);
     po::notify(optVm);
@@ -212,19 +210,14 @@
       usage(visibleOptDesc);
     }
 
-    if (optVm.count("interval") > 0) {
-      options.interval = time::milliseconds(optVm["interval"].as<int>());
-
-      if (options.interval.count() < getMinimumPingInterval().count()) {
-        std::cerr << "ERROR: Specified ping interval is less than the minimum " <<
-                     getMinimumPingInterval() << std::endl;
-        usage(visibleOptDesc);
-      }
+    options.interval = time::milliseconds(optVm["interval"].as<time::milliseconds::rep>());
+    if (options.interval < getMinimumPingInterval()) {
+      std::cerr << "ERROR: Specified ping interval is less than the minimum " <<
+                   getMinimumPingInterval() << std::endl;
+      usage(visibleOptDesc);
     }
 
-    if (optVm.count("timeout") > 0) {
-      options.timeout = time::milliseconds(optVm["timeout"].as<int>());
-    }
+    options.timeout = time::milliseconds(optVm["timeout"].as<time::milliseconds::rep>());
 
     if (optVm.count("count") > 0) {
       if (options.nPings <= 0) {
