diff --git a/tools/dissect/ndn-dissect.cpp b/tools/dissect/ndn-dissect.cpp
index c9d8ece..f37195e 100644
--- a/tools/dissect/ndn-dissect.cpp
+++ b/tools/dissect/ndn-dissect.cpp
@@ -1,5 +1,22 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
+ * Copyright (c) 2014-2015,  Regents of the University of California.
+ *
+ * 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/>.
+ */
+/**
  * Copyright (c) 2013-2014 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -21,14 +38,16 @@
  * @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
  */
 
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/encoding/block.hpp>
+#include "ndn-dissect.hpp"
 
-#include <iomanip>
-#include <fstream>
+#include <algorithm>
 #include <map>
 
+#include <ndn-cxx/name-component.hpp>
+#include <ndn-cxx/util/indented-stream.hpp>
+
 namespace ndn {
+namespace dissect {
 
 std::map<uint32_t, std::string> TLV_DICT = {
   {tlv::Interest                     , "Interest"},
@@ -59,35 +78,33 @@
 };
 
 void
-printTypeInfo(uint32_t type)
+NdnDissect::printType(std::ostream& os, uint32_t type)
 {
-  std::cout << type << " (";
+  os << type << " (";
 
   if (TLV_DICT.count(type) != 0) {
-    std::cout << TLV_DICT[type];
+    os << TLV_DICT[type];
   }
   else if (type < tlv::AppPrivateBlock1) {
-    std::cout << "RESERVED_1";
+    os << "RESERVED_1";
   }
   else if (tlv::AppPrivateBlock1 <= type && type < 253) {
-    std::cout << "APP_TAG_1";
+    os << "APP_TAG_1";
   }
   else if (253 <= type && type < tlv::AppPrivateBlock2) {
-    std::cout << "RESERVED_3";
+    os << "RESERVED_3";
   }
   else {
-    std::cout << "APP_TAG_3";
+    os << "APP_TAG_3";
   }
-  std::cout << ")";
+  os << ")";
 }
 
-
 void
-BlockPrinter(const Block& block, const std::string& indent = "")
+NdnDissect::printBlock(std::ostream& os, const Block& block)
 {
-  std::cout << indent;
-  printTypeInfo(block.type());
-  std::cout << " (size: " << block.value_size() << ")";
+  this->printType(os, block.type());
+  os << " (size: " << block.value_size() << ")";
 
   try {
     // if (block.type() != tlv::Content && block.type() != tlv::SignatureValue)
@@ -99,88 +116,33 @@
     // @todo: Figure how to deterministically figure out that value is not recursive TLV block
   }
 
-  if (block.elements().empty())
-    {
-      std::cout << " [[";
-      name::Component(block.value(), block.value_size()).toUri(std::cout);
-      std::cout<< "]]";
-    }
-  std::cout << std::endl;
+  if (block.elements().empty()) {
+    os << " [[";
+    name::Component(block.value(), block.value_size()).toUri(os);
+    os<< "]]";
+  }
+  os << std::endl;
 
-  for (Block::element_const_iterator i = block.elements_begin();
-       i != block.elements_end();
-       ++i)
-    {
-      BlockPrinter(*i, indent+"  ");
-    }
+  util::IndentedStream os2(os, "  ");
+  std::for_each(block.elements_begin(), block.elements_end(),
+    [this, &os2] (const Block& element) {
+      this->printBlock(os2, element);
+    });
 }
 
 void
-HexPrinter(const Block& block, const std::string& indent = "")
-{
-  std::cout << indent;
-  for (Buffer::const_iterator i = block.begin (); i != block.value_begin(); ++i)
-    {
-      std::cout << "0x";
-      std::cout << std::noshowbase << std::hex << std::setw(2) <<
-        std::setfill('0') << static_cast<int>(*i);
-      std::cout << ", ";
-    }
-  std::cout << "\n";
-
-  if (block.elements_size() == 0 && block.value_size() > 0)
-    {
-      std::cout << indent << "    ";
-      for (Buffer::const_iterator i = block.value_begin (); i != block.value_end(); ++i)
-      {
-        std::cout << "0x";
-        std::cout << std::noshowbase << std::hex << std::setw(2) <<
-          std::setfill('0') << static_cast<int>(*i);
-        std::cout << ", ";
-      }
-      std::cout << "\n";
-    }
-  else
-    {
-      for (Block::element_const_iterator i = block.elements_begin();
-           i != block.elements_end();
-           ++i)
-        {
-          HexPrinter(*i, indent+"    ");
-        }
-    }
-}
-
-void
-parseBlocksFromStream(std::istream& is)
+NdnDissect::dissect(std::ostream& os, std::istream& is)
 {
   while (is.peek() != std::char_traits<char>::eof()) {
     try {
       Block block = Block::fromStream(is);
-      BlockPrinter(block, "");
-      // HexPrinter(block, "");
+      this->printBlock(os, block);
     }
     catch (std::exception& e) {
       std::cerr << "ERROR: " << e.what() << std::endl;
     }
   }
-
 }
 
+} // namespace dissect
 } // namespace ndn
-
-int main(int argc, const char *argv[])
-{
-  if (argc == 1 ||
-      (argc == 2 && std::string(argv[1]) == "-"))
-    {
-      ndn::parseBlocksFromStream(std::cin);
-    }
-  else
-    {
-      std::ifstream file(argv[1]);
-      ndn::parseBlocksFromStream(file);
-    }
-
-  return 0;
-}
