diff --git a/examples/data-producer.cpp b/examples/data-producer.cpp
index e401603..0e1da2c 100644
--- a/examples/data-producer.cpp
+++ b/examples/data-producer.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -138,7 +138,7 @@
 
   std::string name;
   getline(insertStream, name);
-  auto data = createData(ndn::Name(name));
+  auto data = createData(name);
   m_face.put(*data);
 
   m_scheduler.schedule(timeInterval, [this] { generateFromFile(); });
@@ -148,11 +148,10 @@
 Publisher::createData(const ndn::Name& name)
 {
   static ndn::KeyChain keyChain;
-  static std::vector<uint8_t> content(1500, '-');
+  static const std::vector<uint8_t> content(1500, '-');
 
-  auto data = std::make_shared<ndn::Data>();
-  data->setName(name);
-  data->setContent(content.data(), content.size());
+  auto data = std::make_shared<ndn::Data>(name);
+  data->setContent(content);
   keyChain.sign(*data);
   return data;
 }
@@ -203,7 +202,7 @@
         generator.duration = milliseconds(boost::lexical_cast<uint64_t>(optarg));
       }
       catch (const boost::bad_lexical_cast&) {
-        std::cerr << "-s option should be an integer" << std::endl;;
+        std::cerr << "-s option should be an integer" << std::endl;
         return 1;
       }
       break;
@@ -212,7 +211,7 @@
         generator.timeInterval = milliseconds(boost::lexical_cast<uint64_t>(optarg));
       }
       catch (const boost::bad_lexical_cast&) {
-        std::cerr << "-t option should be an integer" << std::endl;;
+        std::cerr << "-t option should be an integer" << std::endl;
         return 1;
       }
       break;
diff --git a/src/handles/tcp-bulk-insert-handle.cpp b/src/handles/tcp-bulk-insert-handle.cpp
index 9c3f680..dc4042d 100644
--- a/src/handles/tcp-bulk-insert-handle.cpp
+++ b/src/handles/tcp-bulk-insert-handle.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -85,7 +85,7 @@
   ip::tcp::resolver::iterator end;
 
   if (endpoint == end)
-    BOOST_THROW_EXCEPTION(Error("Cannot listen on " + host + " port " + port));
+    NDN_THROW(Error("Cannot listen on " + host + " port " + port));
 
   m_localEndpoint = *endpoint;
   NDN_LOG_DEBUG("Start listening on " << m_localEndpoint);
@@ -157,17 +157,17 @@
 
   // do magic
 
+  auto bufferView = ndn::make_span(m_inputBuffer, m_inputBufferSize);
   std::size_t offset = 0;
-
   bool isOk = true;
-  Block element;
-  while (m_inputBufferSize - offset > 0) {
-    std::tie(isOk, element) = Block::fromBuffer(m_inputBuffer + offset, m_inputBufferSize - offset);
+  while (offset < bufferView.size()) {
+    Block element;
+    std::tie(isOk, element) = Block::fromBuffer(bufferView.subspan(offset));
     if (!isOk)
       break;
 
     offset += element.size();
-    BOOST_ASSERT(offset <= m_inputBufferSize);
+    BOOST_ASSERT(offset <= bufferView.size());
 
     if (element.type() == ndn::tlv::Data) {
       try {
@@ -178,9 +178,9 @@
         else
           NDN_LOG_DEBUG("FAILED to inject " << data.getName());
       }
-      catch (const std::runtime_error&) {
+      catch (const std::runtime_error& e) {
         /// \todo Catch specific error after determining what wireDecode() can throw
-        NDN_LOG_ERROR("Error decoding received Data packet");
+        NDN_LOG_ERROR("Error decoding received Data packet: " << e.what());
       }
     }
   }
diff --git a/tests/dataset-fixtures.hpp b/tests/dataset-fixtures.hpp
index 1a4e272..0d93347 100644
--- a/tests/dataset-fixtures.hpp
+++ b/tests/dataset-fixtures.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -21,6 +21,7 @@
 #define REPO_TESTS_DATASET_FIXTURES_HPP
 
 #include "identity-management-fixture.hpp"
+
 #include <vector>
 #include <boost/mpl/vector.hpp>
 
@@ -33,11 +34,7 @@
   class Error : public std::runtime_error
   {
   public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-    }
+    using std::runtime_error::runtime_error;
   };
 
   using DataContainer = std::list<std::shared_ptr<ndn::Data>>;
@@ -56,11 +53,10 @@
     if (map.count(name) > 0)
       return map[name];
 
-    static std::vector<uint8_t> content(1500, '-');
+    static const std::vector<uint8_t> content(1500, '-');
 
-    std::shared_ptr<ndn::Data> data = std::make_shared<ndn::Data>();
-    data->setName(name);
-    data->setContent(&content[0], content.size());
+    auto data = std::make_shared<ndn::Data>(name);
+    data->setContent(content);
     m_keyChain.sign(*data);
 
     map.insert(std::make_pair(name, data));
@@ -73,7 +69,7 @@
     if (map.count(name) > 0)
       return map[name];
     else
-      BOOST_THROW_EXCEPTION(Error("Data with name " + name.toUri() + " is not found"));
+      NDN_THROW(Error("Data with name " + name.toUri() + " is not found"));
   }
 
 private:
diff --git a/tests/integrated/test-basic-command-insert-delete.cpp b/tests/integrated/test-basic-command-insert-delete.cpp
index 03e9a54..5ed5b9b 100644
--- a/tests/integrated/test-basic-command-insert-delete.cpp
+++ b/tests/integrated/test-basic-command-insert-delete.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -32,7 +32,6 @@
 #include <ndn-cxx/util/random.hpp>
 #include <ndn-cxx/util/time.hpp>
 
-#include <boost/asio/io_service.hpp>
 #include <boost/mpl/vector.hpp>
 #include <boost/test/unit_test.hpp>
 
@@ -44,7 +43,7 @@
 // All the test cases in this test suite should be run at once.
 BOOST_AUTO_TEST_SUITE(TestBasicCommandInsertDelete)
 
-const static uint8_t content[8] = {3, 1, 4, 1, 5, 9, 2, 6};
+const uint8_t CONTENT[] = {3, 1, 4, 1, 5, 9, 2, 6};
 
 template<class Dataset>
 class Fixture : public CommandFixture, public RepoStorageFixture, public Dataset
@@ -59,7 +58,7 @@
   {
     Name cmdPrefix("/repo/command");
     repoFace.registerPrefix(cmdPrefix, nullptr,
-      [] (const Name& cmdPrefix, const std::string& reason) {
+      [] (const Name&, const std::string& reason) {
         BOOST_FAIL("Command prefix registration error: " << reason);
       });
   }
@@ -113,11 +112,12 @@
   ndn::security::InterestSigner signer;
 };
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::onInsertInterest(const Interest& interest)
 {
   Data data(Name(interest.getName()));
-  data.setContent(content, sizeof(content));
+  data.setContent(CONTENT);
   data.setFreshnessPeriod(0_ms);
   keyChain.sign(data);
   insertFace.put(data);
@@ -126,56 +126,62 @@
     eventIt->second.cancel();
     insertEvents.erase(eventIt);
   }
-  // schedule an event 50ms later to check whether insert is Ok
-  scheduler.schedule(500_ms, std::bind(&Fixture<T>::checkInsertOk, this, interest));
+
+  // schedule an event to check whether insert is ok
+  scheduler.schedule(500_ms, [=] { this->checkInsertOk(interest); });
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::onRegisterFailed(const std::string& reason)
 {
   BOOST_ERROR("ERROR: Failed to register prefix in local hub's daemon" + reason);
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::delayedInterest()
 {
   BOOST_ERROR("Fetching interest does not come. It may be satisfied in CS or something is wrong");
 }
 
-template<class T> void
-Fixture<T>::onInsertData(const Interest& interest, const Data& data)
+template<class T>
+void
+Fixture<T>::onInsertData(const Interest&, const Data& data)
 {
   RepoCommandResponse response;
   response.wireDecode(data.getContent().blockFromValue());
-  int statusCode = response.getCode();
-  BOOST_CHECK_EQUAL(statusCode, 100);
+  BOOST_CHECK_EQUAL(response.getCode(), 100);
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::onDeleteData(const Interest& interest, const Data& data)
 {
   RepoCommandResponse response;
   response.wireDecode(data.getContent().blockFromValue());
-  int statusCode = response.getCode();
-  BOOST_CHECK_EQUAL(statusCode, 200);
+  BOOST_CHECK_EQUAL(response.getCode(), 200);
 
-  //schedlute an event to check whether delete is Ok.
-  scheduler.schedule(100_ms, std::bind(&Fixture<T>::checkDeleteOk, this, interest));
+  // schedule an event to check whether delete is ok
+  scheduler.schedule(100_ms, [=] { this->checkDeleteOk(interest); });
 }
 
-template<class T> void
-Fixture<T>::onInsertTimeout(const Interest& interest)
+template<class T>
+void
+Fixture<T>::onInsertTimeout(const Interest&)
 {
   BOOST_ERROR("Insert command timeout");
 }
 
-template<class T> void
-Fixture<T>::onDeleteTimeout(const Interest& interest)
+template<class T>
+void
+Fixture<T>::onDeleteTimeout(const Interest&)
 {
   BOOST_ERROR("Delete command timeout");
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::sendInsertInterest(const Interest& insertInterest)
 {
   insertFace.expressInterest(insertInterest,
@@ -184,7 +190,8 @@
                              std::bind(&Fixture<T>::onInsertTimeout, this, _1));
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::sendDeleteInterest(const Interest& deleteInterest)
 {
   deleteFace.expressInterest(deleteInterest,
@@ -193,41 +200,43 @@
                              std::bind(&Fixture<T>::onDeleteTimeout, this, _1));
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::checkInsertOk(const Interest& interest)
 {
-  BOOST_TEST_MESSAGE(interest);
-  std::shared_ptr<Data> data = handle->readData(interest);
-  if (data) {
-    int rc = memcmp(data->getContent().value(), content, sizeof(content));
-    BOOST_CHECK_EQUAL(rc, 0);
-  }
-  else {
-    BOOST_ERROR("Check Insert Failed");
+  BOOST_TEST_CONTEXT("Interest " << interest) {
+    auto data = handle->readData(interest);
+    if (data) {
+      BOOST_TEST(data->getContent().value_bytes() == CONTENT, boost::test_tools::per_element());
+    }
+    else {
+      BOOST_ERROR("Insert check failed");
+    }
   }
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::checkDeleteOk(const Interest& interest)
 {
-  std::map<Name, Name>::iterator name = deleteNamePairs.find(interest.getName());
-  BOOST_CHECK_MESSAGE(name != deleteNamePairs.end(), "Delete name not found: " << interest.getName());
-  Interest dataInterest(name->second);
-  std::shared_ptr<Data> data = handle->readData(dataInterest);
+  auto nameIt = deleteNamePairs.find(interest.getName());
+  BOOST_CHECK_MESSAGE(nameIt != deleteNamePairs.end(), "Delete name not found: " << interest.getName());
+  Interest dataInterest(nameIt->second);
+  auto data = handle->readData(dataInterest);
   BOOST_CHECK(!data);
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::scheduleInsertEvent()
 {
   int timeCount = 1;
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i) {
+  for (auto i = this->data.begin(); i != this->data.end(); ++i) {
     Name insertCommandName("/repo/command/insert");
     RepoCommandParameter insertParameter;
     insertParameter.setName(Name((*i)->getName())
                             .appendNumber(ndn::random::generateWord64()));
-    insertCommandName.append(insertParameter.wireEncode());
+    insertCommandName.append(tlv::GenericNameComponent, insertParameter.wireEncode());
     Interest insertInterest = signer.makeCommandInterest(insertCommandName);
     // schedule a job to express insertInterest every 50ms
     scheduler.schedule(milliseconds(timeCount * 50 + 1000),
@@ -245,17 +254,17 @@
   }
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::scheduleDeleteEvent()
 {
   int timeCount = 1;
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i) {
+  for (auto i = this->data.begin(); i != this->data.end(); ++i) {
     Name deleteCommandName("/repo/command/delete");
     RepoCommandParameter deleteParameter;
     deleteParameter.setProcessId(ndn::random::generateWord64());
     deleteParameter.setName((*i)->getName());
-    deleteCommandName.append(deleteParameter.wireEncode());
+    deleteCommandName.append(tlv::GenericNameComponent, deleteParameter.wireEncode());
     Interest deleteInterest = signer.makeCommandInterest(deleteCommandName);
     deleteNamePairs[deleteInterest.getName()] = (*i)->getName();
     scheduler.schedule(milliseconds(4000 + timeCount * 50),
@@ -271,8 +280,8 @@
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(InsertDelete, T, Datasets, Fixture<T>)
 {
   // schedule events
-  this->scheduler.schedule(0_s, std::bind(&Fixture<T>::scheduleInsertEvent, this));
-  this->scheduler.schedule(10_s, std::bind(&Fixture<T>::scheduleDeleteEvent, this));
+  this->scheduler.schedule(0_s,  [this] { this->scheduleInsertEvent(); });
+  this->scheduler.schedule(10_s, [this] { this->scheduleDeleteEvent(); });
 
   this->repoFace.processEvents(30_s);
 }
diff --git a/tests/integrated/test-basic-interest-read.cpp b/tests/integrated/test-basic-interest-read.cpp
index 81ace5b..ab3da01 100644
--- a/tests/integrated/test-basic-interest-read.cpp
+++ b/tests/integrated/test-basic-interest-read.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -27,17 +27,14 @@
 #include <boost/asio/io_service.hpp>
 #include <boost/test/unit_test.hpp>
 
-#include <ndn-cxx/util/logger.hpp>
 #include <ndn-cxx/util/time.hpp>
 
 namespace repo {
 namespace tests {
 
-NDN_LOG_INIT(repo.tests.read);
+BOOST_AUTO_TEST_SUITE(TestBasicInterestRead)
 
-BOOST_AUTO_TEST_SUITE(TestBasicInerestRead)
-
-const static uint8_t content[8] = {3, 1, 4, 1, 5, 9, 2, 6};
+const uint8_t CONTENT[] = {3, 1, 4, 1, 5, 9, 2, 6};
 
 template<class Dataset>
 class BasicInterestReadFixture : public RepoStorageFixture, public Dataset
@@ -65,17 +62,13 @@
   scheduleReadEvent()
   {
     int timeCount = 1;
-    for (typename Dataset::DataContainer::iterator i = this->data.begin();
-         i != this->data.end(); ++i) {
-      //First insert a data into database;
-      (*i)->setContent(content, sizeof(content));
+    for (auto i = this->data.begin(); i != this->data.end(); ++i) {
+      // First insert a data into database
+      (*i)->setContent(CONTENT);
       (*i)->setFreshnessPeriod(36000_ms);
       keyChain.sign(**i);
-      NDN_LOG_DEBUG(**i);
       bool rc = handle->insertData(**i);
-
       BOOST_CHECK_EQUAL(rc, true);
-      NDN_LOG_DEBUG("Inserted Data " << (**i).getName());
 
       Interest readInterest((*i)->getName());
       readInterest.setMustBeFresh(true);
@@ -86,30 +79,26 @@
   }
 
   void
-  onReadData(const ndn::Interest& interest, const ndn::Data& data)
+  onReadData(const ndn::Interest&, const ndn::Data& data) const
   {
-    int rc = memcmp(data.getContent().value(), content, sizeof(content));
-    BOOST_CHECK_EQUAL(rc, 0);
+    BOOST_TEST(data.getContent().value_bytes() == CONTENT, boost::test_tools::per_element());
   }
 
   void
-  onReadTimeout(const ndn::Interest& interest)
+  onReadTimeout(const ndn::Interest& interest) const
   {
-    NDN_LOG_DEBUG("Timed out " << interest.getName());
-    BOOST_ERROR("Insert or read not successfull");
+    BOOST_ERROR("Read timeout " << interest.getName());
   }
 
   void
-  onReadNack(const ndn::Interest& interest, const ndn::lp::Nack& nack)
+  onReadNack(const ndn::Interest& interest, const ndn::lp::Nack& nack) const
   {
-    NDN_LOG_DEBUG("Nacked " << interest.getName() << nack.getReason());
-    BOOST_ERROR("Read nacked");
+    BOOST_ERROR("Read nack " << interest.getName() << " " << nack.getReason());
   }
 
   void
   sendInterest(const ndn::Interest& interest)
   {
-    NDN_LOG_DEBUG("Sending Interest " << interest.getName());
     readFace.expressInterest(interest,
                              std::bind(&BasicInterestReadFixture::onReadData, this, _1, _2),
                              std::bind(&BasicInterestReadFixture::onReadNack, this, _1, _2),
@@ -124,7 +113,6 @@
   ndn::Face readFace;
 };
 
-
 using Datasets = boost::mpl::vector<BasicDataset,
                                     FetchByPrefixDataset,
                                     SamePrefixDataset<10>>;
@@ -132,7 +120,7 @@
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(Read, T, Datasets, BasicInterestReadFixture<T>)
 {
   this->startListen();
-  this->scheduler.schedule(1_s, std::bind(&BasicInterestReadFixture<T>::scheduleReadEvent, this));
+  this->scheduler.schedule(1_s, [this] { this->scheduleReadEvent(); });
 
   this->repoFace.processEvents(20_s);
 }
diff --git a/tests/unit/read-handle.t.cpp b/tests/unit/read-handle.t.cpp
index 1e22b4e..60a2ee2 100644
--- a/tests/unit/read-handle.t.cpp
+++ b/tests/unit/read-handle.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  Regents of the University of California.
+ * Copyright (c) 2014-2022,  Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -86,8 +86,8 @@
   auto data1 = std::make_shared<Data>(Name{dataPrefix}.appendNumber(1));
   auto data2 = std::make_shared<Data>(Name{dataPrefix}.appendNumber(2));
 
-  data1->setContent(&content[0], content.size());
-  data2->setContent(&content[0], content.size());
+  data1->setContent(content);
+  data2->setContent(content);
 
   keyChain.createIdentity(identity);
   keyChain.sign(*data1, ndn::security::SigningInfo(ndn::security::SigningInfo::SIGNER_TYPE_ID,
diff --git a/tests/unit/tcp-bulk-insert-handle.cpp b/tests/unit/tcp-bulk-insert-handle.cpp
index 48d1ae3..da90117 100644
--- a/tests/unit/tcp-bulk-insert-handle.cpp
+++ b/tests/unit/tcp-bulk-insert-handle.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California.
+ * Copyright (c) 2014-2022,  Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -101,8 +101,7 @@
     // scatter-gather is limited to at most `min(64,IOV_MAX)` buffers to be transmitted
     // in a single operation
     for (auto i = this->data.begin(); i != this->data.end(); ++i) {
-
-      socket.async_send(boost::asio::buffer((*i)->wireEncode().wire(), (*i)->wireEncode().size()),
+      socket.async_send(boost::asio::buffer((*i)->wireEncode()),
                         std::bind(&TcpBulkInsertFixture::onSendFinished, this, _1, false));
     }
     onSendFinished(error, true);
@@ -148,7 +147,6 @@
   repo::TcpBulkInsertHandle bulkInserter;
 };
 
-
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(BulkInsertAndRead, T, CommonDatasets, TcpBulkInsertFixture<T>)
 {
   BOOST_TEST_MESSAGE(T::getName());
diff --git a/tools/ndnputfile.cpp b/tools/ndnputfile.cpp
index 78d4b8a..bed681a 100644
--- a/tools/ndnputfile.cpp
+++ b/tools/ndnputfile.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -155,8 +155,7 @@
   bool m_isFinished;
   ndn::Name m_dataPrefix;
 
-  using DataContainer = std::map<uint64_t, shared_ptr<ndn::Data>>;
-  DataContainer m_data;
+  std::map<uint64_t, std::shared_ptr<ndn::Data>> m_data;
   ndn::security::InterestSigner m_cmdSigner;
 };
 
@@ -185,7 +184,7 @@
     auto readSize = boost::iostreams::read(*insertStream,
                                            reinterpret_cast<char*>(buffer), DEFAULT_BLOCK_SIZE);
     if (readSize <= 0) {
-      BOOST_THROW_EXCEPTION(Error("Error reading from the input stream"));
+      NDN_THROW(Error("Error reading from the input stream"));
     }
 
     auto data = make_shared<ndn::Data>(Name(m_dataPrefix).appendSegment(m_currentSegmentNo));
@@ -195,7 +194,7 @@
       m_isFinished = true;
     }
 
-    data->setContent(buffer, readSize);
+    data->setContent(ndn::make_span(buffer, readSize));
     data->setFreshnessPeriod(freshnessPeriod);
     signData(*data);
 
@@ -251,13 +250,12 @@
 }
 
 void
-NdnPutFile::onInsertCommandResponse(const ndn::Interest& interest, const ndn::Data& data)
+NdnPutFile::onInsertCommandResponse(const ndn::Interest&, const ndn::Data& data)
 {
   RepoCommandResponse response(data.getContent().blockFromValue());
   auto statusCode = response.getCode();
   if (statusCode >= 400) {
-    BOOST_THROW_EXCEPTION(Error("insert command failed with code " +
-                                boost::lexical_cast<std::string>(statusCode)));
+    NDN_THROW(Error("insert command failed with code " + std::to_string(statusCode)));
   }
   m_processId = response.getProcessId();
 
@@ -265,9 +263,9 @@
 }
 
 void
-NdnPutFile::onInsertCommandTimeout(const ndn::Interest& interest)
+NdnPutFile::onInsertCommandTimeout(const ndn::Interest&)
 {
-  BOOST_THROW_EXCEPTION(Error("command response timeout"));
+  NDN_THROW(Error("command response timeout"));
 }
 
 void
@@ -296,7 +294,7 @@
 
   prepareNextData(segmentNo);
 
-  DataContainer::iterator item = m_data.find(segmentNo);
+  auto item = m_data.find(segmentNo);
   if (item == m_data.end()) {
     if (isVerbose) {
       std::cerr << "Requested segment [" << segmentNo << "] does not exist" << std::endl;
@@ -328,15 +326,15 @@
     boost::iostreams::read(*insertStream, reinterpret_cast<char*>(buffer), DEFAULT_BLOCK_SIZE);
 
   if (readSize <= 0) {
-    BOOST_THROW_EXCEPTION(Error("Error reading from the input stream"));
+    NDN_THROW(Error("Error reading from the input stream"));
   }
 
   if (insertStream->peek() != std::istream::traits_type::eof()) {
-    BOOST_THROW_EXCEPTION(Error("Input data does not fit into one Data packet"));
+    NDN_THROW(Error("Input data does not fit into one Data packet"));
   }
 
   auto data = make_shared<ndn::Data>(m_dataPrefix);
-  data->setContent(buffer, readSize);
+  data->setContent(ndn::make_span(buffer, readSize));
   data->setFreshnessPeriod(freshnessPeriod);
   signData(*data);
   m_face.put(*data);
@@ -347,7 +345,7 @@
 void
 NdnPutFile::onRegisterFailed(const ndn::Name& prefix, const std::string& reason)
 {
-  BOOST_THROW_EXCEPTION(Error("onRegisterFailed: " + reason));
+  NDN_THROW(Error("onRegisterFailed: " + reason));
 }
 
 void
@@ -382,13 +380,12 @@
 }
 
 void
-NdnPutFile::onCheckCommandResponse(const ndn::Interest& interest, const ndn::Data& data)
+NdnPutFile::onCheckCommandResponse(const ndn::Interest&, const ndn::Data& data)
 {
   RepoCommandResponse response(data.getContent().blockFromValue());
   auto statusCode = response.getCode();
   if (statusCode >= 400) {
-    BOOST_THROW_EXCEPTION(Error("Insert check command failed with code: " +
-                                boost::lexical_cast<std::string>(statusCode)));
+    NDN_THROW(Error("Insert check command failed with code " + std::to_string(statusCode)));
   }
 
   if (m_isFinished) {
@@ -413,9 +410,9 @@
 }
 
 void
-NdnPutFile::onCheckCommandTimeout(const ndn::Interest& interest)
+NdnPutFile::onCheckCommandTimeout(const ndn::Interest&)
 {
-  BOOST_THROW_EXCEPTION(Error("check response timeout"));
+  NDN_THROW(Error("check response timeout"));
 }
 
 ndn::Interest
@@ -423,13 +420,12 @@
                                     const RepoCommandParameter& commandParameter)
 {
   Name cmd = commandPrefix;
-  cmd
-    .append(command)
-    .append(commandParameter.wireEncode());
-  ndn::Interest interest;
+  cmd.append(command).append(tlv::GenericNameComponent, commandParameter.wireEncode());
 
-  if (identityForCommand.empty())
+  ndn::Interest interest;
+  if (identityForCommand.empty()) {
     interest = m_cmdSigner.makeCommandInterest(cmd);
+  }
   else {
     interest = m_cmdSigner.makeCommandInterest(cmd, ndn::signingByIdentity(identityForCommand));
   }
@@ -493,7 +489,7 @@
         ndnPutFile.freshnessPeriod = milliseconds(boost::lexical_cast<uint64_t>(optarg));
       }
       catch (const boost::bad_lexical_cast&) {
-        std::cerr << "-x option should be an integer" << std::endl;;
+        std::cerr << "-x option should be an integer" << std::endl;
         return 2;
       }
       break;
@@ -502,7 +498,7 @@
         ndnPutFile.interestLifetime = milliseconds(boost::lexical_cast<uint64_t>(optarg));
       }
       catch (const boost::bad_lexical_cast&) {
-        std::cerr << "-l option should be an integer" << std::endl;;
+        std::cerr << "-l option should be an integer" << std::endl;
         return 2;
       }
       break;
@@ -512,7 +508,7 @@
         ndnPutFile.timeout = milliseconds(boost::lexical_cast<uint64_t>(optarg));
       }
       catch (const boost::bad_lexical_cast&) {
-        std::cerr << "-w option should be an integer" << std::endl;;
+        std::cerr << "-w option should be an integer" << std::endl;
         return 2;
       }
       break;
diff --git a/wscript b/wscript
index 6e6974f..8108387 100644
--- a/wscript
+++ b/wscript
@@ -28,12 +28,13 @@
     conf.env.WITH_TESTS = conf.options.with_tests
     conf.env.WITH_TOOLS = conf.options.with_tools
 
-    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDN_CXX',
-                   pkg_config_path=os.environ.get('PKG_CONFIG_PATH', '%s/pkgconfig' % conf.env.LIBDIR))
+    pkg_config_path = os.environ.get('PKG_CONFIG_PATH', f'{conf.env.LIBDIR}/pkgconfig')
+    conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.0', '--cflags', '--libs'],
+                   uselib_store='NDN_CXX', pkg_config_path=pkg_config_path)
 
     conf.check_sqlite3()
 
-    boost_libs = ['system', 'program_options', 'iostreams', 'filesystem', 'thread', 'log']
+    boost_libs = ['system', 'program_options', 'filesystem', 'iostreams']
     if conf.env.WITH_TESTS:
         boost_libs.append('unit_test_framework')
     conf.check_boost(lib=boost_libs, mt=True)
