diff --git a/tests/chunks/discover-version-iterative.t.cpp b/tests/chunks/discover-version-iterative.t.cpp
deleted file mode 100644
index 79c6fb7..0000000
--- a/tests/chunks/discover-version-iterative.t.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2016,  Regents of the University of California,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University.
- *
- * This file is part of ndn-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Andrea Tosatto
- */
-
-#include "tools/chunks/catchunks/discover-version-iterative.hpp"
-
-#include "discover-version-fixture.hpp"
-
-namespace ndn {
-namespace chunks {
-namespace tests {
-
-class DiscoverVersionIterativeFixture : public DiscoverVersionFixture,
-                                        protected DiscoverVersionIterativeOptions
-{
-public:
-  typedef DiscoverVersionIterativeOptions Options;
-
-public:
-  explicit
-  DiscoverVersionIterativeFixture(const Options& opt = makeOptionsIterative())
-    : chunks::Options(opt)
-    , DiscoverVersionFixture(opt)
-    , Options(opt)
-  {
-    setDiscover(make_unique<DiscoverVersionIterative>(Name(name), face, opt));
-  }
-
-protected:
-  static Options
-  makeOptionsIterative()
-  {
-    Options options;
-    options.isVerbose = false;
-    options.maxRetriesOnTimeoutOrNack = 3;
-    options.maxRetriesAfterVersionFound = 1;
-    return options;
-  }
-};
-
-
-BOOST_AUTO_TEST_SUITE(Chunks)
-BOOST_AUTO_TEST_SUITE(TestDiscoverVersionIterative)
-
-BOOST_FIXTURE_TEST_CASE(SingleVersionAvailable, DiscoverVersionIterativeFixture)
-{
-  discover->run();
-  advanceClocks(io, time::nanoseconds(1), 1);
-
-  uint64_t version = 1449241767037;
-
-  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
-  auto lastInterest = face.sentInterests.back();
-  BOOST_CHECK_EQUAL(lastInterest.getExclude().size(), 0);
-  BOOST_CHECK_EQUAL(lastInterest.getChildSelector(), 1);
-  BOOST_CHECK_EQUAL(lastInterest.getMustBeFresh(), mustBeFresh);
-  BOOST_CHECK_EQUAL(lastInterest.getName().equals(name), true);
-
-  // Send first segment for the right version
-  face.receive(*makeDataWithVersion(version));
-  advanceClocks(io, time::nanoseconds(1), 1);
-
-  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 2);
-  lastInterest = face.sentInterests.back();
-  Exclude expectedExclude;
-  expectedExclude.excludeBefore(name::Component::fromVersion(version));
-  BOOST_CHECK_EQUAL(lastInterest.getExclude(), expectedExclude);
-  BOOST_CHECK_EQUAL(lastInterest.getChildSelector(), 1);
-  BOOST_CHECK_EQUAL(lastInterest.getMustBeFresh(), mustBeFresh);
-  BOOST_CHECK_EQUAL(lastInterest.getName().equals(name), true);
-
-  // Generate the timeout
-  for (int retries = 0; retries < maxRetriesAfterVersionFound; ++retries) {
-    advanceClocks(io, interestLifetime, 1);
-
-    BOOST_CHECK_EQUAL(isDiscoveryFinished, false);
-
-    BOOST_REQUIRE_EQUAL(face.sentInterests.size(), retries + 3);
-    lastInterest = face.sentInterests.back();
-    Exclude expectedExclude;
-    expectedExclude.excludeBefore(name::Component::fromVersion(version));
-    BOOST_CHECK_EQUAL(lastInterest.getExclude(), expectedExclude);
-    BOOST_CHECK_EQUAL(lastInterest.getChildSelector(), 1);
-    BOOST_CHECK_EQUAL(lastInterest.getMustBeFresh(), mustBeFresh);
-    BOOST_CHECK_EQUAL(lastInterest.getName().equals(name), true);
-  }
-
-  advanceClocks(io, interestLifetime, 1);
-  BOOST_CHECK_EQUAL(isDiscoveryFinished, true);
-  BOOST_CHECK_EQUAL(discoveredVersion, version);
-  BOOST_CHECK_EQUAL(face.sentInterests.size(), maxRetriesAfterVersionFound + 2);
-}
-
-
-BOOST_FIXTURE_TEST_CASE(NoVersionsAvailable, DiscoverVersionIterativeFixture)
-{
-  discover->run();
-  advanceClocks(io, time::nanoseconds(1), 1);
-  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
-
-  for (int retries = 0; retries < maxRetriesOnTimeoutOrNack; ++retries) {
-    advanceClocks(io, interestLifetime, 1);
-    BOOST_CHECK_EQUAL(isDiscoveryFinished, false);
-    BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 2 + retries);
-  }
-
-  for (auto& lastInterest : face.sentInterests) {
-    BOOST_CHECK_EQUAL(lastInterest.getExclude().size(), 0);
-    BOOST_CHECK_EQUAL(lastInterest.getChildSelector(), 1);
-    BOOST_CHECK_EQUAL(lastInterest.getMustBeFresh(), mustBeFresh);
-    BOOST_CHECK_EQUAL(lastInterest.getName().equals(name), true);
-  }
-
-  advanceClocks(io, interestLifetime, 1);
-  BOOST_CHECK_EQUAL(isDiscoveryFinished, true);
-  BOOST_CHECK_EQUAL(face.sentInterests.size(), maxRetriesOnTimeoutOrNack + 1);
-}
-
-BOOST_FIXTURE_TEST_CASE(MultipleVersionsAvailable, DiscoverVersionIterativeFixture)
-{
-  // nVersions must be positive
-  const uint64_t nVersions = 5;
-
-  discover->run();
-  advanceClocks(io, time::nanoseconds(1), 1);
-
-  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
-  auto lastInterest = face.sentInterests.back();
-  BOOST_CHECK_EQUAL(lastInterest.getExclude().size(), 0);
-  BOOST_CHECK_EQUAL(lastInterest.getChildSelector(), 1);
-  BOOST_CHECK_EQUAL(lastInterest.getMustBeFresh(), mustBeFresh);
-  BOOST_CHECK_EQUAL(lastInterest.getName().equals(name), true);
-
-  for (uint64_t nSentVersions = 0; nSentVersions < nVersions; ++nSentVersions) {
-    face.receive(*makeDataWithVersion(nSentVersions));
-    advanceClocks(io, time::nanoseconds(1), 1);
-
-    BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 2 + nSentVersions);
-    lastInterest = face.sentInterests.back();
-    Exclude expectedExclude;
-    expectedExclude.excludeBefore(name::Component::fromVersion(nSentVersions));
-    BOOST_CHECK_EQUAL(lastInterest.getExclude(), expectedExclude);
-    BOOST_CHECK_EQUAL(lastInterest.getChildSelector(), 1);
-    BOOST_CHECK_EQUAL(lastInterest.getMustBeFresh(), mustBeFresh);
-    BOOST_CHECK_EQUAL(lastInterest.getName().equals(name), true);
-  }
-
-  for (int retries = 0; retries < maxRetriesAfterVersionFound; ++retries) {
-    advanceClocks(io, interestLifetime, 1);
-
-    BOOST_CHECK_EQUAL(isDiscoveryFinished, false);
-
-    BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 2 + retries + nVersions);
-    lastInterest = face.sentInterests.back();
-    Exclude expectedExclude;
-    expectedExclude.excludeBefore(name::Component::fromVersion(nVersions - 1));
-    BOOST_CHECK_EQUAL(lastInterest.getExclude(), expectedExclude);
-    BOOST_CHECK_EQUAL(lastInterest.getChildSelector(), 1);
-    BOOST_CHECK_EQUAL(lastInterest.getMustBeFresh(), mustBeFresh);
-    BOOST_CHECK_EQUAL(lastInterest.getName().equals(name), true);
-  }
-
-  advanceClocks(io, interestLifetime, 1);
-  BOOST_CHECK_EQUAL(isDiscoveryFinished, true);
-  BOOST_CHECK_EQUAL(discoveredVersion, nVersions - 1);
-  BOOST_CHECK_EQUAL(face.sentInterests.size(), nVersions + maxRetriesAfterVersionFound + 1);
-}
-
-BOOST_FIXTURE_TEST_CASE(MultipleVersionsAvailableDescendent, DiscoverVersionIterativeFixture)
-{
-  // nVersions must be positive
-  const uint64_t nVersions = 5;
-
-  discover->run();
-  advanceClocks(io, time::nanoseconds(1), 1);
-
-  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
-  auto lastInterest = face.sentInterests.back();
-  BOOST_CHECK_EQUAL(isDiscoveryFinished, false);
-  BOOST_CHECK_EQUAL(lastInterest.getExclude().size(), 0);
-  BOOST_CHECK_EQUAL(lastInterest.getChildSelector(), 1);
-  BOOST_CHECK_EQUAL(lastInterest.getMustBeFresh(), mustBeFresh);
-  BOOST_CHECK_EQUAL(lastInterest.getName().equals(name), true);
-
-  for (uint64_t nVersionsToSend = nVersions; nVersionsToSend > 0; --nVersionsToSend) {
-    face.receive(*makeDataWithVersion(nVersionsToSend - 1));
-    advanceClocks(io, time::nanoseconds(1), 1);
-
-    BOOST_CHECK_EQUAL(isDiscoveryFinished, false);
-
-    BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 2);
-    lastInterest = face.sentInterests.back();
-    Exclude expectedExclude;
-    expectedExclude.excludeBefore(name::Component::fromVersion(nVersions - 1));
-    BOOST_CHECK_EQUAL(lastInterest.getExclude(), expectedExclude);
-    BOOST_CHECK_EQUAL(lastInterest.getChildSelector(), 1);
-    BOOST_CHECK_EQUAL(lastInterest.getMustBeFresh(), mustBeFresh);
-    BOOST_CHECK_EQUAL(lastInterest.getName().equals(name), true);
-  }
-
-  advanceClocks(io, interestLifetime, maxRetriesAfterVersionFound + 1);
-  BOOST_CHECK_EQUAL(isDiscoveryFinished, true);
-  BOOST_CHECK_EQUAL(discoveredVersion, nVersions - 1);
-  BOOST_CHECK_EQUAL(face.sentInterests.size(), maxRetriesAfterVersionFound + 2);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // TestDiscoverVersionIterative
-BOOST_AUTO_TEST_SUITE_END() // Chunks
-
-} // namespace tests
-} // namespace chunks
-} // namespace ndn
diff --git a/tools/chunks/README.md b/tools/chunks/README.md
index 2bdd8ff..0c76fe8 100644
--- a/tools/chunks/README.md
+++ b/tools/chunks/README.md
@@ -17,13 +17,15 @@
                specified prefix and version number. A version component must be present at the
                end of the user-specified NDN name.
 
-* `iterative`: sends a series of interests with ChildSelector set to prefer the
-               rightmost child and Exclude selectors, attempting to find a data packet with the
-               specified prefix and the latest (the largest in the NDN canonical ordering)
-               version number.  The version is declared "latest" after a predefined number of
-               data retrieval timeouts (default: 1).
+* `realtime` : sends discovery interests to fetch metadata of the solicited content from which
+               the data version will be resolved.
+               The version number of the solicited content is included in the name of returned
+               metadata data packet.
+               For more information about the packet format and naming convention of interest and
+               data packets for realtime version discovery, please refer to:
+[Realtime Data Retrieval (RDR) protocol wiki page](https://redmine.named-data.net/projects/ndn-tlv/wiki/RDR)
 
-The default discovery method is `iterative`.
+The default discovery method is `realtime`.
 
 ## Interest pipeline types in ndncatchunks
 
@@ -70,9 +72,9 @@
 
 To retrieve the latest version of a published file, the following command can be used:
 
-    ndncatchunks -d iterative ndn:/localhost/demo/gpl3
+    ndncatchunks ndn:/localhost/demo/gpl3
 
-This command will use the iterative method to discover the latest version of the file.
+This command will use the realtime method to discover the version number of the file.
 
 To fetch a specific version of a published file, you can use the `fixed` version discovery method.
 In this case the version needs to be supplied as part of the name. For example, if the version
diff --git a/tools/chunks/catchunks/discover-version-iterative.cpp b/tools/chunks/catchunks/discover-version-iterative.cpp
deleted file mode 100644
index adeb48e..0000000
--- a/tools/chunks/catchunks/discover-version-iterative.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2016-2019, Regents of the University of California,
- *                          Colorado State University,
- *                          University Pierre & Marie Curie, Sorbonne University.
- *
- * This file is part of ndn-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Wentao Shang
- * @author Steve DiBenedetto
- * @author Andrea Tosatto
- * @author Klaus Schneider
- */
-
-#include "discover-version-iterative.hpp"
-
-namespace ndn {
-namespace chunks {
-
-DiscoverVersionIterative::DiscoverVersionIterative(const Name& prefix, Face& face,
-                                                   const Options& options)
-  : chunks::Options(options)
-  , DiscoverVersion(prefix, face)
-  , Options(options)
-  , m_latestVersion(0)
-  , m_foundVersion(false)
-{
-}
-
-void
-DiscoverVersionIterative::run()
-{
-  m_latestVersion = 0;
-  m_foundVersion = false;
-
-  Interest interest(m_prefix);
-  interest.setInterestLifetime(interestLifetime);
-  interest.setMustBeFresh(mustBeFresh);
-  interest.setMinSuffixComponents(3);
-  interest.setMaxSuffixComponents(3);
-  interest.setChildSelector(1);
-
-  expressInterest(interest, maxRetriesOnTimeoutOrNack, maxRetriesOnTimeoutOrNack);
-}
-
-void
-DiscoverVersionIterative::handleData(const Interest& interest, const Data& data)
-{
-  size_t versionindex = m_prefix.size();
-
-  const Name& name = data.getName();
-  Exclude exclude;
-
-  if (isVerbose)
-    std::cerr << "Data: " << data << std::endl;
-
-  BOOST_ASSERT(name.size() > m_prefix.size());
-  if (name[versionindex].isVersion()) {
-    m_latestVersion = name[versionindex].toVersion();
-    m_latestVersionData = make_shared<Data>(data);
-    m_foundVersion = true;
-
-    exclude.excludeBefore(name[versionindex]);
-
-    if (isVerbose)
-      std::cerr << "Discovered version = " << m_latestVersion << std::endl;
-  }
-  else {
-    // didn't find a version number at expected index.
-    m_strayExcludes.excludeOne(name[versionindex]);
-  }
-
-  for (const Exclude::Range& range : m_strayExcludes) {
-    BOOST_ASSERT(range.isSingular());
-    exclude.excludeOne(range.from);
-  }
-
-  Interest newInterest(interest);
-  newInterest.refreshNonce();
-  newInterest.setExclude(exclude);
-  newInterest.setInterestLifetime(discoveryTimeout);
-
-  if (m_foundVersion)
-    expressInterest(newInterest, maxRetriesOnTimeoutOrNack, maxRetriesAfterVersionFound);
-  else
-    expressInterest(interest, maxRetriesOnTimeoutOrNack, maxRetriesOnTimeoutOrNack);
-}
-
-void
-DiscoverVersionIterative::handleTimeout(const Interest& interest, const std::string& reason)
-{
-  if (m_foundVersion) {
-    // a version has been found and after a timeout error this version can be used as the latest.
-    if (isVerbose)
-      std::cerr << "Found data with the latest version: " << m_latestVersion << std::endl;
-
-    // we discovered at least one version. assume what we have is the latest.
-    this->emitSignal(onDiscoverySuccess, Name(interest.getName()).appendVersion(m_latestVersion));
-  }
-  else {
-    DiscoverVersion::handleTimeout(interest, reason);
-  }
-}
-
-void
-DiscoverVersionIterative::handleNack(const Interest& interest, const std::string& reason)
-{
-  if (m_foundVersion) {
-    // a version has been found and after a nack this version can be used as the latest.
-    if (isVerbose)
-      std::cerr << "Found data with the latest version: " << m_latestVersion << std::endl;
-
-    // we discovered at least one version. assume what we have is the latest.
-    this->emitSignal(onDiscoverySuccess, Name(interest.getName()).appendVersion(m_latestVersion));
-  }
-  else {
-    DiscoverVersion::handleNack(interest, reason);
-  }
-}
-
-} // namespace chunks
-} // namespace ndn
diff --git a/tools/chunks/catchunks/discover-version-iterative.hpp b/tools/chunks/catchunks/discover-version-iterative.hpp
deleted file mode 100644
index 8880a6d..0000000
--- a/tools/chunks/catchunks/discover-version-iterative.hpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2016-2019, Regents of the University of California,
- *                          Colorado State University,
- *                          University Pierre & Marie Curie, Sorbonne University.
- *
- * This file is part of ndn-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Wentao Shang
- * @author Steve DiBenedetto
- * @author Andrea Tosatto
- * @author Klaus Schneider
- */
-
-#ifndef NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_ITERATIVE_HPP
-#define NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_ITERATIVE_HPP
-
-#include "discover-version.hpp"
-
-namespace ndn {
-namespace chunks {
-
-/**
- * @brief Options for discover version iterative DiscoverVersionIterative
- *
- * The canonical name to use is DiscoverVersionIterative::Options
- */
-class DiscoverVersionIterativeOptions : public virtual Options
-{
-public:
-  explicit
-  DiscoverVersionIterativeOptions(const Options& opts = Options())
-    : Options(opts)
-  {
-  }
-
-public:
-  int maxRetriesAfterVersionFound{0};       ///< how many times to retry after a discoveryTimeout
-  time::milliseconds discoveryTimeout{300}; ///< timeout for version discovery
-};
-
-/**
- * @brief Service for discovering the latest Data version in the iterative way
- *
- * Identifies the latest retrievable version published under the specified namespace
- * (as specified by the Version marker).
- *
- * DiscoverVersionIterative declares the largest discovered version to be the latest after some
- * Interest timeouts (i.e. failed retrieval after exclusion and retransmission). The number of
- * timeouts are specified by the value of maxRetriesAfterVersionFound inside the iterative options.
- *
- * The received name component after version can be an invalid segment number, this component will
- * be excluded in the next interests. In the unlikely case that there are too many excluded
- * components such that the Interest cannot fit in ndn::MAX_NDN_PACKET_SIZE, the discovery
- * procedure will throw Face::Error.
- *
- * DiscoverVersionIterative's user is notified once after identifying the latest retrievable
- * version or on failure to find any version Data.
- */
-class DiscoverVersionIterative : public DiscoverVersion, protected DiscoverVersionIterativeOptions
-{
-public:
-  typedef DiscoverVersionIterativeOptions Options;
-
-public:
-  /**
-   * @brief create a DiscoverVersionIterative service
-   */
-  DiscoverVersionIterative(const Name& prefix, Face& face, const Options& options);
-
-  /**
-   * @brief identify the latest Data version published.
-   */
-  void
-  run() final;
-
-private:
-  void
-  handleData(const Interest& interest, const Data& data) final;
-
-  void
-  handleTimeout(const Interest& interest, const std::string& reason) final;
-
-  void
-  handleNack(const Interest& interest, const std::string& reason) final;
-
-private:
-  uint64_t m_latestVersion;
-  shared_ptr<const Data> m_latestVersionData;
-  Exclude m_strayExcludes;
-  bool m_foundVersion;
-};
-
-} // namespace chunks
-} // namespace ndn
-
-#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_ITERATIVE_HPP
diff --git a/tools/chunks/catchunks/ndncatchunks.cpp b/tools/chunks/catchunks/ndncatchunks.cpp
index 2224f48..92d5401 100644
--- a/tools/chunks/catchunks/ndncatchunks.cpp
+++ b/tools/chunks/catchunks/ndncatchunks.cpp
@@ -33,7 +33,6 @@
 #include "aimd-rtt-estimator.hpp"
 #include "consumer.hpp"
 #include "discover-version-fixed.hpp"
-#include "discover-version-iterative.hpp"
 #include "discover-version-realtime.hpp"
 #include "pipeline-interests-aimd.hpp"
 #include "pipeline-interests-fixed-window.hpp"
@@ -51,11 +50,10 @@
 {
   std::string programName(argv[0]);
   Options options;
-  std::string discoverType("iterative");
+  std::string discoverType("realtime");
   std::string pipelineType("aimd");
   size_t maxPipelineSize(1);
-  int maxRetriesAfterVersionFound(0);
-  int64_t discoveryTimeoutMs(300);
+  int64_t discoveryTimeoutMs(DEFAULT_INTEREST_LIFETIME.count());
   std::string uri;
 
   // congestion control parameters, CWA refers to conservative window adaptation,
@@ -71,7 +69,7 @@
   basicDesc.add_options()
     ("help,h",      "print this help message and exit")
     ("discover-version,d", po::value<std::string>(&discoverType)->default_value(discoverType),
-                            "version discovery algorithm to use; valid values are: 'fixed', 'iterative', 'realtime'")
+                            "version discovery algorithm to use; valid values are: 'fixed', 'realtime'")
     ("pipeline-type,p", po::value<std::string>(&pipelineType)->default_value(pipelineType),
                          "type of Interest pipeline to use; valid values are: 'fixed', 'aimd'")
     ("fresh,f",     po::bool_switch(&options.mustBeFresh), "only return fresh content")
@@ -84,14 +82,10 @@
     ("version,V",   "print program version and exit")
     ;
 
-  po::options_description iterDiscoveryDesc("Iterative version discovery options");
-  iterDiscoveryDesc.add_options()
-    ("retries-iterative,i", po::value<int>(&maxRetriesAfterVersionFound)->default_value(maxRetriesAfterVersionFound),
-                            "number of timeouts that have to occur in order to confirm a discovered Data "
-                            "version as the latest one")
+  po::options_description realDiscoveryDesc("Realtime version discovery options");
+  realDiscoveryDesc.add_options()
     ("discovery-timeout,t", po::value<int64_t>(&discoveryTimeoutMs)->default_value(discoveryTimeoutMs),
-                            "discovery timeout (in milliseconds)")
-    ;
+                            "discovery timeout (in milliseconds)");
 
   po::options_description fixedPipeDesc("Fixed pipeline options");
   fixedPipeDesc.add_options()
@@ -136,7 +130,7 @@
     ;
 
   po::options_description visibleDesc;
-  visibleDesc.add(basicDesc).add(iterDiscoveryDesc).add(fixedPipeDesc).add(aimdPipeDesc);
+  visibleDesc.add(basicDesc).add(realDiscoveryDesc).add(fixedPipeDesc).add(aimdPipeDesc);
 
   po::options_description hiddenDesc;
   hiddenDesc.add_options()
@@ -196,11 +190,6 @@
     return 2;
   }
 
-  if (maxRetriesAfterVersionFound < 0 || maxRetriesAfterVersionFound > 1024) {
-    std::cerr << "ERROR: retries iterative value must be between 0 and 1024" << std::endl;
-    return 2;
-  }
-
   if (discoveryTimeoutMs < 0) {
     std::cerr << "ERROR: timeout cannot be negative" << std::endl;
     return 2;
@@ -224,14 +213,9 @@
     if (discoverType == "fixed") {
       discover = make_unique<DiscoverVersionFixed>(prefix, face, options);
     }
-    else if (discoverType == "iterative") {
-      DiscoverVersionIterative::Options optionsIterative(options);
-      optionsIterative.maxRetriesAfterVersionFound = maxRetriesAfterVersionFound;
-      optionsIterative.discoveryTimeout = time::milliseconds(discoveryTimeoutMs);
-      discover = make_unique<DiscoverVersionIterative>(prefix, face, optionsIterative);
-    }
     else if (discoverType == "realtime") {
       DiscoverVersionRealtime::Options optionsRealtime(options);
+      optionsRealtime.discoveryTimeout = time::milliseconds(discoveryTimeoutMs);
       discover = make_unique<DiscoverVersionRealtime>(prefix, face, optionsRealtime);
     }
     else {
