diff --git a/tools/chunks/README.md b/tools/chunks/README.md
index f1cf967..d92710f 100644
--- a/tools/chunks/README.md
+++ b/tools/chunks/README.md
@@ -11,22 +11,15 @@
   discovering the latest version of the file, and writes the content of the retrieved file to
   the standard output.
 
-## Version discovery methods in ndncatchunks
+## Version discovery in ndncatchunks
 
-* `fixed`    : sends an Interest attempting to find a data packet with the
-               specified prefix and version number. A version component must be present at the
-               end of the user-specified NDN name.
-
-* `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:
+If a version component is present at the end of the user-specified NDN name, the provided version
+number will be used, without any version discovery process. Otherwise, discovery Interest(s) will
+be sent out to fetch metadata of the solicited content from which the Data version will be resolved.
+For more information about the packet format and naming convention of Interest and Data packets of
+version discovery in ndncatchunks, 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 `realtime`.
-
 ## Interest pipeline types in ndncatchunks
 
 * `fixed`: maintains a fixed-size window of Interests in flight; the window size is configurable
@@ -50,40 +43,35 @@
 The following command will publish the text of the GPL-3 license under the `/localhost/demo/gpl3`
 prefix:
 
-    ndnputchunks ndn:/localhost/demo/gpl3 < /usr/share/common-licenses/GPL-3
+    ndnputchunks /localhost/demo/gpl3 < /usr/share/common-licenses/GPL-3
 
 To find the published version you have to start ndnputchunks with the `-p` command line option,
 for example:
 
-    ndnputchunks -p ndn:/localhost/demo/gpl3 < /usr/share/common-licenses/GPL-3
+    ndnputchunks -p /localhost/demo/gpl3 < /usr/share/common-licenses/GPL-3
 
 This command will print the published version to the standard output.
 
-To publish data with a specific version, you must append a version component to the end of the
+To publish Data with a specific version, you must append a version component to the end of the
 prefix. The version component must follow the aforementioned NDN naming conventions.
 For example, the following command will publish the version `%FD%00%00%01Qc%CF%17v` of the
 `/localhost/demo/gpl3` prefix:
 
-    ndnputchunks ndn:/localhost/demo/gpl3/%FD%00%00%01Qc%CF%17v < /usr/share/common-licenses/GPL-3
+    ndnputchunks /localhost/demo/gpl3/%FD%00%00%01Qc%CF%17v < /usr/share/common-licenses/GPL-3
 
 If the version component is not valid, a new well-formed version will be generated and appended
 to the supplied NDN name.
 
-
 ### Retrieval
 
 To retrieve the latest version of a published file, the following command can be used:
 
-    ndncatchunks ndn:/localhost/demo/gpl3
+    ndncatchunks /localhost/demo/gpl3
 
-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 specify the version number at the end of
+the name. For example, if the version is known to be `%FD%00%00%01Qc%CF%17v`, the following command
+will fetch that exact version of the file (without version discovery):
 
-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
-is known to be `%FD%00%00%01Qc%CF%17v`, the following command will fetch that exact version of the
-file:
-
-    ndncatchunks -d fixed ndn:/localhost/demo/gpl3/%FD%00%00%01Qc%CF%17v
-
+    ndncatchunks /localhost/demo/gpl3/%FD%00%00%01Qc%CF%17v
 
 For more information, run the programs with `--help` as argument.
diff --git a/tools/chunks/catchunks/discover-version-fixed.cpp b/tools/chunks/catchunks/discover-version-fixed.cpp
deleted file mode 100644
index c122d2f..0000000
--- a/tools/chunks/catchunks/discover-version-fixed.cpp
+++ /dev/null
@@ -1,76 +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 Andrea Tosatto
- */
-
-#include "discover-version-fixed.hpp"
-
-namespace ndn {
-namespace chunks {
-
-DiscoverVersionFixed::DiscoverVersionFixed(const Name& prefix, Face& face, const Options& options)
-  : Options(options)
-  , DiscoverVersion(prefix, face)
-{
-}
-
-void
-DiscoverVersionFixed::run()
-{
-  Interest interest(m_prefix);
-  interest.setInterestLifetime(interestLifetime);
-  interest.setMustBeFresh(mustBeFresh);
-  interest.setMaxSuffixComponents(2);
-  interest.setMinSuffixComponents(2);
-
-  expressInterest(interest, maxRetriesOnTimeoutOrNack, maxRetriesOnTimeoutOrNack);
-}
-
-void
-DiscoverVersionFixed::handleData(const Interest& interest, const Data& data)
-{
-  if (isVerbose)
-    std::cerr << "Data: " << data << std::endl;
-
-  // data name must end with a segment number, preceded by a version number
-  if (data.getName().size() >= 2 &&
-      data.getName()[-1].isSegment() &&
-      data.getName()[-2].isVersion()) {
-    if (isVerbose)
-      std::cerr << "Found data with the requested version: " << data.getName()[-2] << std::endl;
-
-    this->emitSignal(onDiscoverySuccess, data.getName().getPrefix(-1));
-  }
-  else {
-    // data isn't a valid segment, add to the exclude list
-    m_strayExcludes.excludeOne(data.getName()[-1]);
-    Interest newInterest(interest);
-    newInterest.refreshNonce();
-    newInterest.setExclude(m_strayExcludes);
-
-    expressInterest(newInterest, maxRetriesOnTimeoutOrNack, maxRetriesOnTimeoutOrNack);
-  }
-}
-
-} // namespace chunks
-} // namespace ndn
diff --git a/tools/chunks/catchunks/discover-version-fixed.hpp b/tools/chunks/catchunks/discover-version-fixed.hpp
deleted file mode 100644
index 2514098..0000000
--- a/tools/chunks/catchunks/discover-version-fixed.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2016-2017, 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
- */
-
-#ifndef NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_FIXED_HPP
-#define NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_FIXED_HPP
-
-#include "discover-version.hpp"
-
-namespace ndn {
-namespace chunks {
-
-/**
- * @brief Service to retrieve a specific version segment. The version is specified in the prefix
- *
- * Send a request of a specific version and expect to be answered with one segment.
- *
- * 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.
- *
- * DiscoverVersionFixed's user is notified once after one segment with the user specified version
- * is found or on failure to find any Data version.
- */
-class DiscoverVersionFixed : public DiscoverVersion
-{
-public:
-  /**
-   * @brief create a DiscoverVersionFixed service
-   */
-  DiscoverVersionFixed(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;
-
-private:
-  Exclude m_strayExcludes;
-};
-
-} // namespace chunks
-} // namespace ndn
-
-#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_FIXED_HPP
diff --git a/tools/chunks/catchunks/discover-version-realtime.cpp b/tools/chunks/catchunks/discover-version-realtime.cpp
deleted file mode 100644
index 7175211..0000000
--- a/tools/chunks/catchunks/discover-version-realtime.cpp
+++ /dev/null
@@ -1,79 +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 Chavoosh Ghasemi <chghasemi@cs.arizona.edu>
- */
-
-#include "discover-version-realtime.hpp"
-
-#include <ndn-cxx/metadata-object.hpp>
-
-namespace ndn {
-namespace chunks {
-
-DiscoverVersionRealtime::DiscoverVersionRealtime(const Name& prefix,
-                                                 Face& face,
-                                                 const Options& options)
-  : chunks::Options(options)
-  , DiscoverVersion(prefix, face)
-  , Options(options)
-{
-}
-
-void
-DiscoverVersionRealtime::run()
-{
-  expressInterest(MetadataObject::makeDiscoveryInterest(m_prefix)
-                  .setInterestLifetime(discoveryTimeout),
-                  maxRetriesOnTimeoutOrNack, maxRetriesOnTimeoutOrNack);
-}
-
-void
-DiscoverVersionRealtime::handleData(const Interest& interest, const Data& data)
-{
-  if (isVerbose)
-    std::cerr << "Data: " << data << std::endl;
-
-  // make a metadata object from received metadata packet
-  MetadataObject mobject;
-  try {
-    mobject = MetadataObject(data);
-  }
-  catch (const tlv::Error& e) {
-    this->emitSignal(onDiscoveryFailure, "Invalid metadata packet: "s + e.what());
-    return;
-  }
-
-  if (mobject.getVersionedName().empty() || !mobject.getVersionedName()[-1].isVersion()) {
-    this->emitSignal(onDiscoveryFailure, mobject.getVersionedName().toUri() +
-                                         " is not a valid versioned name");
-    return;
-  }
-
-  if (isVerbose) {
-    std::cerr << "Discovered Data version: " << mobject.getVersionedName()[-1].toVersion() << std::endl;
-  }
-  this->emitSignal(onDiscoverySuccess, mobject.getVersionedName());
-}
-
-} // namespace chunks
-} // namespace ndn
diff --git a/tools/chunks/catchunks/discover-version-realtime.hpp b/tools/chunks/catchunks/discover-version-realtime.hpp
deleted file mode 100644
index 2e3f975..0000000
--- a/tools/chunks/catchunks/discover-version-realtime.hpp
+++ /dev/null
@@ -1,85 +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 Chavoosh Ghasemi <chghasemi@cs.arizona.edu>
- */
-
-#ifndef NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_REALTIME_HPP
-#define NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_REALTIME_HPP
-
-#include "discover-version.hpp"
-
-namespace ndn {
-namespace chunks {
-
-/**
- * @brief Options for discover version realtime
- *
- * The canonical name to use is DiscoverVersionRealtime::Options
- */
-class DiscoverVersionRealtimeOptions : public virtual Options
-{
-public:
-  explicit
-  DiscoverVersionRealtimeOptions(const Options& opts = Options())
-    : Options(opts)
-  {
-  }
-
-public:
-  time::milliseconds discoveryTimeout{DEFAULT_INTEREST_LIFETIME}; ///< timeout for version discovery
-};
-
-/**
- * @brief Service for discovering Data version by sending discovery interests
- *
- * This service employs RDR-style metadata class for version discovery.
- * @see https://redmine.named-data.net/projects/ndn-tlv/wiki/RDR
- */
-class DiscoverVersionRealtime : public DiscoverVersion, protected DiscoverVersionRealtimeOptions
-{
-public:
-  typedef DiscoverVersionRealtimeOptions Options;
-
-public:
-  /**
-   * @param prefix Name of solicited data
-   * @param face The face through which discovery Interests are expressed
-   * @param options Additional information about the service
-   */
-  DiscoverVersionRealtime(const Name& prefix, Face& face, const Options& options);
-
-  /**
-   * @brief Send a discovery Interest out
-   */
-  void
-  run() final;
-
-private:
-  void
-  handleData(const Interest& interest, const Data& data) final;
-};
-
-} // namespace chunks
-} // namespace ndn
-
-#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_REALTIME_HPP
diff --git a/tools/chunks/catchunks/discover-version.cpp b/tools/chunks/catchunks/discover-version.cpp
index 3a4309c..7ac5195 100644
--- a/tools/chunks/catchunks/discover-version.cpp
+++ b/tools/chunks/catchunks/discover-version.cpp
@@ -23,42 +23,73 @@
  * @author Wentao Shang
  * @author Steve DiBenedetto
  * @author Andrea Tosatto
+ * @author Chavoosh Ghasemi
  */
 
 #include "discover-version.hpp"
 #include "data-fetcher.hpp"
 
+#include <ndn-cxx/metadata-object.hpp>
+
 namespace ndn {
 namespace chunks {
 
-DiscoverVersion::DiscoverVersion(const Name& prefix, Face& face)
-  : m_prefix(prefix)
+DiscoverVersion::DiscoverVersion(const Name& prefix, Face& face, const Options& options)
+  : chunks::Options(options)
+  , m_prefix(prefix)
   , m_face(face)
 {
 }
 
-DiscoverVersion::~DiscoverVersion() = default;
-
 void
-DiscoverVersion::expressInterest(const Interest& interest, int maxRetriesNack, int maxRetriesTimeout)
+DiscoverVersion::run()
 {
-  fetcher = DataFetcher::fetch(m_face, interest, maxRetriesNack, maxRetriesTimeout,
-                               bind(&DiscoverVersion::handleData, this, _1, _2),
-                               bind(&DiscoverVersion::handleNack, this, _1, _2),
-                               bind(&DiscoverVersion::handleTimeout, this, _1, _2),
-                               isVerbose);
+  if (!m_prefix.empty() && m_prefix[-1].isVersion()) {
+    onDiscoverySuccess(m_prefix);
+    return;
+  }
+
+  Interest interest = MetadataObject::makeDiscoveryInterest(m_prefix)
+                                      .setInterestLifetime(interestLifetime);
+
+  m_fetcher = DataFetcher::fetch(m_face, interest,
+                                 maxRetriesOnTimeoutOrNack, maxRetriesOnTimeoutOrNack,
+                                 bind(&DiscoverVersion::handleData, this, _1, _2),
+                                 [this] (const Interest& interest, const std::string& reason) {
+                                   onDiscoveryFailure(reason);
+                                 },
+                                 [this] (const Interest& interest, const std::string& reason) {
+                                   onDiscoveryFailure(reason);
+                                 },
+                                 isVerbose);
 }
 
 void
-DiscoverVersion::handleNack(const Interest& interest, const std::string& reason)
+DiscoverVersion::handleData(const Interest& interest, const Data& data)
 {
-  onDiscoveryFailure(reason);
-}
+  if (isVerbose)
+    std::cerr << "Data: " << data << std::endl;
 
-void
-DiscoverVersion::handleTimeout(const Interest& interest, const std::string& reason)
-{
-  onDiscoveryFailure(reason);
+  // make a metadata object from received metadata packet
+  MetadataObject mobject;
+  try {
+    mobject = MetadataObject(data);
+  }
+  catch (const tlv::Error& e) {
+    onDiscoveryFailure("Invalid metadata packet: "s + e.what());
+    return;
+  }
+
+  if (mobject.getVersionedName().empty() || !mobject.getVersionedName()[-1].isVersion()) {
+    onDiscoveryFailure(mobject.getVersionedName().toUri() + " is not a valid versioned name");
+    return;
+  }
+
+  if (isVerbose) {
+    std::cerr << "Discovered Data version: " << mobject.getVersionedName()[-1] << std::endl;
+  }
+
+  onDiscoverySuccess(mobject.getVersionedName());
 }
 
 } // namespace chunks
diff --git a/tools/chunks/catchunks/discover-version.hpp b/tools/chunks/catchunks/discover-version.hpp
index d29f94a..5049cc2 100644
--- a/tools/chunks/catchunks/discover-version.hpp
+++ b/tools/chunks/catchunks/discover-version.hpp
@@ -23,6 +23,7 @@
  * @author Wentao Shang
  * @author Steve DiBenedetto
  * @author Andrea Tosatto
+ * @author Chavoosh Ghasemi
  */
 
 #ifndef NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_HPP
@@ -53,43 +54,28 @@
   /**
    * @brief Signal emitted when a failure occurs.
    */
-  signal::Signal<DiscoverVersion, const std::string&> onDiscoveryFailure;
-
-  DECLARE_SIGNAL_EMIT(onDiscoverySuccess)
-  DECLARE_SIGNAL_EMIT(onDiscoveryFailure)
+  signal::Signal<DiscoverVersion, std::string> onDiscoveryFailure;
 
 public:
   /**
    * @brief create a DiscoverVersion service
    */
-  DiscoverVersion(const Name& prefix, Face& face);
-
-  virtual
-  ~DiscoverVersion();
+  DiscoverVersion(const Name& prefix, Face& face, const Options& options);
 
   /**
    * @brief identify the latest Data version published.
    */
-  virtual void
-  run() = 0;
-
-protected:
   void
-  expressInterest(const Interest& interest, int maxRetriesNack, int maxRetriesTimeout);
+  run();
 
-  virtual void
-  handleData(const Interest& interest, const Data& data) = 0;
+private:
+  void
+  handleData(const Interest& interest, const Data& data);
 
-  virtual void
-  handleNack(const Interest& interest, const std::string& reason);
-
-  virtual void
-  handleTimeout(const Interest& interest, const std::string& reason);
-
-protected:
+private:
   const Name m_prefix;
   Face& m_face;
-  shared_ptr<DataFetcher> fetcher;
+  shared_ptr<DataFetcher> m_fetcher;
 };
 
 } // namespace chunks
diff --git a/tools/chunks/catchunks/main.cpp b/tools/chunks/catchunks/main.cpp
index 718fb49..af345cf 100644
--- a/tools/chunks/catchunks/main.cpp
+++ b/tools/chunks/catchunks/main.cpp
@@ -30,8 +30,7 @@
  */
 
 #include "consumer.hpp"
-#include "discover-version-fixed.hpp"
-#include "discover-version-realtime.hpp"
+#include "discover-version.hpp"
 #include "options.hpp"
 #include "pipeline-interests-aimd.hpp"
 #include "pipeline-interests-cubic.hpp"
@@ -51,10 +50,8 @@
 {
   std::string programName(argv[0]);
   Options options;
-  std::string discoverType("realtime");
   std::string pipelineType("cubic");
   size_t maxPipelineSize(1);
-  int64_t discoveryTimeoutMs(DEFAULT_INTEREST_LIFETIME.count());
   std::string uri;
 
   // congestion control parameters, CWA refers to conservative window adaptation,
@@ -70,8 +67,6 @@
   po::options_description basicDesc("Basic Options");
   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', 'realtime'")
     ("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")
@@ -84,11 +79,6 @@
     ("version,V",   "print program version and exit")
     ;
 
-  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)");
-
   po::options_description fixedPipeDesc("Fixed pipeline options");
   fixedPipeDesc.add_options()
     ("pipeline-size,s", po::value<size_t>(&maxPipelineSize)->default_value(maxPipelineSize),
@@ -136,7 +126,6 @@
 
   po::options_description visibleDesc;
   visibleDesc.add(basicDesc)
-             .add(realDiscoveryDesc)
              .add(fixedPipeDesc)
              .add(adaptivePipeDesc)
              .add(cubicPipeDesc);
@@ -145,11 +134,16 @@
   hiddenDesc.add_options()
     ("ndn-name,n", po::value<std::string>(&uri), "NDN name of the requested content");
 
+  po::options_description deprecatedDesc;
+  deprecatedDesc.add_options()
+    ("discover-version,d", po::value<std::string>(), "version discovery algorithm to use")
+    ("discovery-timeout,t", po::value<int64_t>(), "discovery timeout (in milliseconds)");
+
   po::positional_options_description p;
   p.add("ndn-name", -1);
 
   po::options_description optDesc;
-  optDesc.add(visibleDesc).add(hiddenDesc);
+  optDesc.add(visibleDesc).add(hiddenDesc).add(deprecatedDesc);
 
   po::variables_map vm;
   try {
@@ -171,6 +165,14 @@
     return 0;
   }
 
+  if (vm.count("discover-version") > 0) {
+    std::cout << "WARNING: -d option is deprecated and will be removed in the near future" << std::endl;
+  }
+
+  if (vm.count("discovery-timeout") > 0) {
+    std::cout << "WARNING: -t option is deprecated and will be removed in the near future" << std::endl;
+  }
+
   if (vm.count("version") > 0) {
     std::cout << "ndncatchunks " << tools::VERSION << std::endl;
     return 0;
@@ -182,13 +184,6 @@
     return 2;
   }
 
-  Name prefix(uri);
-  if (discoverType == "fixed" && (prefix.empty() || !prefix[-1].isVersion())) {
-    std::cerr << "ERROR: The specified name must contain a version component when using "
-                 "fixed version discovery" << std::endl;
-    return 2;
-  }
-
   if (maxPipelineSize < 1 || maxPipelineSize > 1024) {
     std::cerr << "ERROR: pipeline size must be between 1 and 1024" << std::endl;
     return 2;
@@ -199,11 +194,6 @@
     return 2;
   }
 
-  if (discoveryTimeoutMs < 0) {
-    std::cerr << "ERROR: timeout cannot be negative" << std::endl;
-    return 2;
-  }
-
   if (vm["lifetime"].as<int64_t>() < 0) {
     std::cerr << "ERROR: lifetime cannot be negative" << std::endl;
     return 2;
@@ -218,19 +208,7 @@
   try {
     Face face;
 
-    unique_ptr<DiscoverVersion> discover;
-    if (discoverType == "fixed") {
-      discover = make_unique<DiscoverVersionFixed>(prefix, face, options);
-    }
-    else if (discoverType == "realtime") {
-      DiscoverVersionRealtime::Options optionsRealtime(options);
-      optionsRealtime.discoveryTimeout = time::milliseconds(discoveryTimeoutMs);
-      discover = make_unique<DiscoverVersionRealtime>(prefix, face, optionsRealtime);
-    }
-    else {
-      std::cerr << "ERROR: discover version type not valid" << std::endl;
-      return 2;
-    }
+    auto discover = make_unique<DiscoverVersion>(Name(uri), face, options);
 
     unique_ptr<PipelineInterests> pipeline;
     unique_ptr<StatisticsCollector> statsCollector;
