diff --git a/tests/other/cs-smoketest.cpp b/tests/other/cs-smoketest.cpp
index 57c92ef..1fc97c9 100644
--- a/tests/other/cs-smoketest.cpp
+++ b/tests/other/cs-smoketest.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,15 +21,14 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- *
- * \author Ilya Moiseenko <iliamo@ucla.edu>
- **/
+ */
 
 #include "table/cs.hpp"
 #include "table/cs-entry.hpp"
 #include <ndn-cxx/security/key-chain.hpp>
 
 namespace nfd {
+namespace cs_smoketest {
 
 static void
 runStressTest()
@@ -41,70 +41,71 @@
                                         reinterpret_cast<const uint8_t*>(0), 0));
 
   // 182 MB in memory
-  for (int i = 0; i < 70000; i++)
-    {
-      Name name("/stress/test");
-      name.appendNumber(i % 4);
-      name.appendNumber(i);
+  for (int i = 0; i < 70000; i++) {
+    Name name("/stress/test");
+    name.appendNumber(i % 4);
+    name.appendNumber(i);
 
-      shared_ptr<Interest> interest = make_shared<Interest>(name);
-      interestWorkload[i] = interest;
+    shared_ptr<Interest> interest = make_shared<Interest>(name);
+    interestWorkload[i] = interest;
 
-      shared_ptr<Data> data = make_shared<Data>(name);
-      data->setSignature(fakeSignature);
-      dataWorkload[i] = data;
-    }
+    shared_ptr<Data> data = make_shared<Data>(name);
+    data->setSignature(fakeSignature);
+    dataWorkload[i] = data;
+  }
 
   time::duration<double, boost::nano> previousResult(0);
 
-  for (size_t nInsertions = 1000; nInsertions < 10000000; nInsertions *= 2)
-    {
-      Cs cs;
-      srand(time::toUnixTimestamp(time::system_clock::now()).count());
+  for (size_t nInsertions = 1000; nInsertions < 10000000; nInsertions *= 2) {
+    Cs cs;
+    srand(time::toUnixTimestamp(time::system_clock::now()).count());
 
-      time::steady_clock::TimePoint startTime = time::steady_clock::now();
+    time::steady_clock::TimePoint startTime = time::steady_clock::now();
 
-      size_t workloadCounter = 0;
-      for (size_t i = 0; i < nInsertions; i++)
-        {
-          if (workloadCounter > 69999)
-            workloadCounter = 0;
+    size_t workloadCounter = 0;
+    for (size_t i = 0; i < nInsertions; i++) {
+      if (workloadCounter > 69999)
+        workloadCounter = 0;
 
-          cs.find(*interestWorkload[workloadCounter]);
-          cs.insert(*dataWorkload[workloadCounter]);
+      cs.find(*interestWorkload[workloadCounter]);
+      Data& data = *dataWorkload[workloadCounter];
+      data.setName(data.getName()); // reset data.m_fullName
+      data.wireEncode();
+      cs.insert(data);
 
-          workloadCounter++;
-        }
-
-      time::steady_clock::TimePoint endTime = time::steady_clock::now();
-
-      time::duration<double, boost::nano> runDuration = endTime - startTime;
-      time::duration<double, boost::nano> perOperationTime = runDuration / nInsertions;
-
-      std::cout << "nItem = " << nInsertions << std::endl;
-      std::cout << "Total running time = "
-                << time::duration_cast<time::duration<double> >(runDuration)
-                << std::endl;
-      std::cout << "Average per-operation time = "
-                << time::duration_cast<time::duration<double, boost::micro> >(perOperationTime)
-                << std::endl;
-
-      if (previousResult > time::nanoseconds(1))
-        std::cout << "Change compared to the previous: "
-                  << (100.0 * perOperationTime / previousResult) << "%" << std::endl;
-
-      std::cout << "\n=================================\n" << std::endl;
-
-      previousResult = perOperationTime;
+      workloadCounter++;
     }
+
+    time::steady_clock::TimePoint endTime = time::steady_clock::now();
+
+    time::duration<double, boost::nano> runDuration = endTime - startTime;
+    time::duration<double, boost::nano> perOperationTime = runDuration / nInsertions;
+
+    std::cout << "nItem = " << nInsertions << std::endl;
+    std::cout << "Total running time = "
+              << time::duration_cast<time::duration<double> >(runDuration)
+              << std::endl;
+    std::cout << "Average per-operation time = "
+              << time::duration_cast<time::duration<double, boost::micro> >(perOperationTime)
+              << std::endl;
+
+    if (previousResult > time::nanoseconds(1))
+      std::cout << "Change compared to the previous: "
+                << (100.0 * perOperationTime / previousResult) << "%" << std::endl;
+
+    std::cout << "\n=================================\n" << std::endl;
+
+    previousResult = perOperationTime;
+  }
 }
 
+} // namespace cs_smoketest
 } // namespace nfd
 
 int
 main(int argc, char** argv)
 {
-  nfd::runStressTest();
+  nfd::cs_smoketest::runStressTest();
 
   return 0;
 }
