diff --git a/ndn-cpp/data.cc b/ndn-cpp/data.cc
deleted file mode 100644
index 5a44da8..0000000
--- a/ndn-cpp/data.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Alexander Afanasyev
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "data.h"
-
-namespace ndn {
-
-Data::Data ()
-{
-}
-
-Data::~Data ()
-{
-}
-
-} // namespace ndn
diff --git a/ndn-cpp/data.h b/ndn-cpp/data.h
deleted file mode 100644
index 962bfe5..0000000
--- a/ndn-cpp/data.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Alexander Afanasyev
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDN_DATA_H
-#define NDN_DATA_H
-
-#include "ndn-cpp/fields/name.h"
-#include "ndn-cpp/fields/content.h"
-#include "ndn-cpp/fields/signature.h"
-#include "ndn-cpp/fields/signed-blob.h"
-
-namespace ndn {
-
-/**
- * @brief Class implementing abstractions to work with NDN Data packets
- */
-class Data
-{
-public:
-  /**
-   * @brief Create an empty Data with empty payload
-   **/
-  Data ();
-
-  /**
-   * @brief Destructor
-   */
-  ~Data ();
-
-  /**
-   * @brief Set data packet name
-   * @param name name of the data packet
-   * @return reference to self (to allow method chaining)
-   *
-   * In some cases, a direct access to and manipulation of name using getName is more efficient
-   */
-  inline Data &
-  setName (const Name &name);
-
-  /**
-   * @brief Get data packet name (const reference)
-   * @returns name of the data packet
-   */
-  inline const Name &
-  getName () const;
-
-  /**
-   * @brief Get data packet name (reference)
-   * @returns name of the data packet
-   */
-  inline Name &
-  getName ();
-
-  /**
-   * @brief Get const smart pointer to signature object
-   */
-  inline ptr_lib::shared_ptr<const Signature>
-  getSignature () const;
-
-  /**
-   * @brief Get smart pointer to signature object
-   */
-  inline ptr_lib::shared_ptr<Signature>
-  getSignature ();
-
-  /**
-   * @brief Set signature object
-   * @param signature smart pointer to a signature object
-   */
-  inline void
-  setSignature (ptr_lib::shared_ptr<Signature> sigature);
-
-  /**
-   * @brief Get const reference to content object (content info + actual content)
-   */
-  inline const Content &
-  getContent () const;
-
-  /**
-   * @brief Get reference to content object (content info + actual content)
-   */
-  inline Content &
-  getContent ();
-
-  /**
-   * @brief Set content object (content info + actual content)
-   * @param content reference to a content object
-   *
-   * More efficient way (that avoids copying):
-   * @code
-   * Content content (...);
-   * getContent ().swap (content);
-   * @endcode
-   */
-  inline void
-  setContent (const Content &content);
-
-  /**
-   * @brief A helper method to directly access actual content data (const reference)
-   *
-   * This method is equivalent to
-   * @code
-   * getContent ().getContent ()
-   * @endcode
-   */
-  inline const Blob &
-  content () const;
-
-  /**
-   * @brief A helper method to directly access actual content data (reference)
-   *
-   * This method is equivalent to
-   * @code
-   * getContent ().getContent ()
-   * @endcode
-   */
-  inline Blob &
-  content ();
-
-private:
-  Name m_name;
-  ptr_lib::shared_ptr<Signature> m_signature; // signature with its parameters "binds" name and content
-  Content m_content;
-
-  ptr_lib::shared_ptr<SignedBlob> m_wire;  
-};
-
-inline Data &
-Data::setName (const Name &name)
-{
-  m_name = name;
-  return *this;
-}
-
-inline const Name &
-Data::getName () const
-{
-  return m_name;
-}
-
-inline Name &
-Data::getName ()
-{
-  return m_name;
-}
-
-inline ptr_lib::shared_ptr<const Signature>
-Data::getSignature () const
-{
-  return m_signature;
-}
-
-inline ptr_lib::shared_ptr<Signature>
-Data::getSignature ()
-{
-  return m_signature;
-}
-
-inline void
-Data::setSignature (ptr_lib::shared_ptr<Signature> signature)
-{
-  m_signature = signature;
-}
-
-inline const Content &
-Data::getContent () const
-{
-  return m_content;
-}
-
-inline Content &
-Data::getContent ()
-{
-  return m_content;
-}
-
-inline void
-Data::setContent (const Content &content)
-{
-  m_content = content;
-}
-
-inline const Blob &
-Data::content () const
-{
-  return getContent ().getContent ();
-}
-
-inline Blob &
-Data::content ()
-{
-  return getContent ().getContent ();
-}
-
-} // namespace ndn
-
-#endif // NDN_DATA_H
diff --git a/ndn-cpp/encoding/base.h b/ndn-cpp/encoding/base.h
deleted file mode 100644
index 8247d09..0000000
--- a/ndn-cpp/encoding/base.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Alexander Afanasyev
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDN_WIRE_BASE_H
-#define NDN_WIRE_BASE_H
-
-#include "ndn-cpp/fields/signature-sha256-with-rsa.h"
-
-namespace ndn {
-namespace wire {
-
-/**
- * @brief Class defining interface for double dispatch pattern (=visitor pattern)
- *        to format variable fields in wire format
- */
-class Base
-{
-public:
-  virtual void
-  appendSignature (std::ostream &os, const signature::Sha256WithRsa &signature, void *userData) = 0;
-};
-
-} // wire
-} // ndn
-
-#endif // NDN_WIRE_BASE_H
diff --git a/ndn-cpp/encoding/ccnb.cc b/ndn-cpp/encoding/ccnb.cc
deleted file mode 100644
index 86c3f5f..0000000
--- a/ndn-cpp/encoding/ccnb.cc
+++ /dev/null
@@ -1,259 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Alexander Afanasyev
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ccnb.h"
-#include "ndn-cpp/error.h"
-
-#include <boost/lexical_cast.hpp>
-
-namespace ndn {
-namespace wire {
-
-#define CCN_TT_BITS 3
-#define CCN_TT_MASK ((1 << CCN_TT_BITS) - 1)
-#define CCN_MAX_TINY ((1 << (7-CCN_TT_BITS)) - 1)
-#define CCN_TT_HBIT ((unsigned char)(1 << 7))
-
-void
-Ccnb::appendBlockHeader (std::ostream &os, size_t val, Ccnb::ccn_tt tt)
-{
-  unsigned char buf[1+8*((sizeof(val)+6)/7)];
-  unsigned char *p = &(buf[sizeof(buf)-1]);
-  size_t n = 1;
-  p[0] = (CCN_TT_HBIT & ~Ccnb::CCN_CLOSE_TAG) |
-  ((val & CCN_MAX_TINY) << CCN_TT_BITS) |
-  (CCN_TT_MASK & tt);
-  val >>= (7-CCN_TT_BITS);
-  while (val != 0) {
-    (--p)[0] = (((unsigned char)val) & ~CCN_TT_HBIT) | Ccnb::CCN_CLOSE_TAG;
-    n++;
-    val >>= 7;
-  }
-  os.write (reinterpret_cast<const char*> (p), n);
-  // return n;
-}
-
-void
-Ccnb::appendNumber (std::ostream &os, uint32_t number)
-{
-  std::string numberStr = boost::lexical_cast<std::string> (number);
-
-  appendBlockHeader (os, numberStr.size (), Ccnb::CCN_UDATA);
-  numberStr.size ();
-  os.write (numberStr.c_str (), numberStr.size ());
-}
-
-void
-Ccnb::appendName (std::ostream &os, const Name &name)
-{
-  Ccnb::appendBlockHeader (os, Ccnb::CCN_DTAG_Name, Ccnb::CCN_DTAG); // <Name>
-  for (Name::const_iterator component = name.begin (); component != name.end (); component ++)
-    {
-      appendTaggedBlob (os, Ccnb::CCN_DTAG_Component, component->buf (), component->size ());
-    }
-  Ccnb::appendCloser (os);                                        // </Name>
-}
-
-void
-Ccnb::appendTimestampBlob (std::ostream &os, const TimeInterval &time)
-{
-  // CCNx method function implements some markers, which are not really defined anywhere else...
-
-  // Determine miminal number of bytes required to store the timestamp
-  int required_bytes = 2; // 12 bits for fractions of a second, 4 bits left for seconds. Sometimes it is enough
-  intmax_t ts = time.total_seconds () >> 4;
-  for (;  required_bytes < 7 && ts != 0; ts >>= 8) // not more than 6 bytes?
-     required_bytes++;
-
-  appendBlockHeader(os, required_bytes, Ccnb::CCN_BLOB);
-
-  // write part with seconds
-  ts = time.total_seconds () >> 4;
-  for (int i = 0; i < required_bytes - 2; i++)
-    os.put ( ts >> (8 * (required_bytes - 3 - i)) );
-
-  /* arithmetic contortions are to avoid overflowing 31 bits */
-  ts = ((time.total_seconds () & 15) << 12) +
-    (((time.total_nanoseconds () % 1000000000) / 5 * 8 + 195312) / 390625);
-  for (int i = required_bytes - 2; i < required_bytes; i++)
-    os.put ( ts >> (8 * (required_bytes - 1 - i)) );
-
-  // return len + required_bytes;
-}
-
-void
-Ccnb::appendExclude (std::ostream &os, const Exclude &exclude)
-{
-  appendBlockHeader (os, Ccnb::CCN_DTAG_Exclude, Ccnb::CCN_DTAG); // <Exclude>
-
-  for (Exclude::const_reverse_iterator item = exclude.rbegin (); item != exclude.rend (); item ++)
-    {
-      if (!item->first.empty ())
-        appendTaggedBlob (os, Ccnb::CCN_DTAG_Component, item->first.buf (), item->first.size ());
-      if (item->second)
-        {
-          appendBlockHeader (os, Ccnb::CCN_DTAG_Any, Ccnb::CCN_DTAG); // <Any>
-          appendCloser (os); // </Any>
-        }
-    }
-  appendCloser (os); // </Exclude>
-}
-
-void
-Ccnb::appendInterest (std::ostream &os, const Interest &interest)
-{
-  Ccnb::appendBlockHeader (os, Ccnb::CCN_DTAG_Interest, Ccnb::CCN_DTAG); // <Interest>
-
-  // this is used for now as an interest template. Name should be empty
-  // Ccnb::appendName (os, interest.getName ());
-  Ccnb::appendName (os, Name ());                              // <Component>...</Component>...
-
-  if (interest.getMinSuffixComponents () != Interest::ncomps)
-    {
-      appendTaggedNumber (os, Ccnb::CCN_DTAG_MinSuffixComponents, interest.getMinSuffixComponents ());
-    }
-  if (interest.getMaxSuffixComponents () != Interest::ncomps)
-    {
-      appendTaggedNumber (os, Ccnb::CCN_DTAG_MaxSuffixComponents, interest.getMaxSuffixComponents ());
-    }
-  if (interest.getExclude ().size () > 0)
-    {
-      appendExclude (os, interest.getExclude ());
-    }
-  if (interest.getChildSelector () != Interest::CHILD_DEFAULT)
-    {
-      appendTaggedNumber (os, Ccnb::CCN_DTAG_ChildSelector, interest.getChildSelector ());
-    }
-  if (interest.getAnswerOriginKind () != Interest::AOK_DEFAULT)
-    {
-      appendTaggedNumber (os, Ccnb::CCN_DTAG_AnswerOriginKind, interest.getAnswerOriginKind ());
-    }
-  if (interest.getScope () != Interest::NO_SCOPE)
-    {
-      appendTaggedNumber (os, Ccnb::CCN_DTAG_Scope, interest.getScope ());
-    }
-  if (!interest.getInterestLifetime ().is_negative ())
-    {
-      Ccnb::appendBlockHeader (os, Ccnb::CCN_DTAG_InterestLifetime, Ccnb::CCN_DTAG);
-      Ccnb::appendTimestampBlob (os, interest.getInterestLifetime ());
-      Ccnb::appendCloser (os);
-    }
-  // if (GetNonce()>0)
-  //   {
-  //     uint32_t nonce = interest.GetNonce();
-  //     appendTaggedBlob (start, Ccnb::CCN_DTAG_Nonce, nonce);
-  //   }
-
-  // if (GetNack ()>0)
-  //   {
-  //     appendBlockHeader (start, Ccnb::CCN_DTAG_Nack, Ccnb::CCN_DTAG);
-  //     appendNumber (start, interest.GetNack ());
-  //     appendCloser (start);
-  //   }
-  Ccnb::appendCloser (os); // </Interest>
-}
-
-static void *SIGNATURE_Block = 0;
-static void *SINATURE_INFO_PublisherPublicKeyDigest = reinterpret_cast<void *> (1);
-static void *SINATURE_INFO_KeyLocator = reinterpret_cast<void *> (2);
-
-static const char TYPES [][3] =  {
-  {0x0C, 0x04, 0xC0},
-  {0x10, 0xD0, 0x91},
-  {0x18, 0xE3, 0x44},
-  {0x28, 0x46, 0x3F},
-  {0x2C, 0x83, 0x4A},
-  {0x34, 0x00, 0x8A}
-};
-
-void
-Ccnb::appendSignature (std::ostream &os, const signature::Sha256WithRsa &signature, void *userData)
-{
-  if (userData == SIGNATURE_Block)
-    {
-      Ccnb::appendBlockHeader (os, Ccnb::CCN_DTAG_Signature, Ccnb::CCN_DTAG); // <Signature>
-      // if (signature.getDigestAlgorithm () != "2.16.840.1.101.3.4.2.1")
-      //   {
-      //     appendString (os, Ccnb::CCN_DTAG_DigestAlgorithm, signature.getDigestAlgorithm ());
-      //   }
-      appendTaggedBlob (os, Ccnb::CCN_DTAG_SignatureBits, signature.getSignatureBits ());
-      Ccnb::appendCloser (os); // </Signature>
-    }
-  else if (userData == SINATURE_INFO_PublisherPublicKeyDigest)
-    {
-      Ccnb::appendTaggedBlob (os, Ccnb::CCN_DTAG_PublisherPublicKeyDigest, signature.getPublisherKeyDigest ());
-    }
-  else if (userData == SINATURE_INFO_KeyLocator)
-    {
-      Ccnb::appendBlockHeader (os, Ccnb::CCN_DTAG_Signature, Ccnb::CCN_DTAG); // <Signature>
-      switch (signature.getKeyLocator ().getType ())
-        {
-        case KeyLocator::NOTSET:
-          break;
-        case KeyLocator::KEY:
-          Ccnb::appendTaggedBlob (os, Ccnb::CCN_DTAG_Key, signature.getKeyLocator ().getKey ());
-          break;
-        case KeyLocator::CERTIFICATE:
-          Ccnb::appendTaggedBlob (os, Ccnb::CCN_DTAG_Key, signature.getKeyLocator ().getCertificate ());
-          break;
-        case KeyLocator::KEYNAME:
-          Ccnb::appendBlockHeader (os, Ccnb::CCN_DTAG_KeyName, Ccnb::CCN_DTAG); // <KeyName>
-          Ccnb::appendName (os, signature.getKeyLocator ().getKeyName ());
-          Ccnb::appendCloser (os); // </KeyName>
-          break;
-        }
-      Ccnb::appendCloser (os); // </Signature>
-    }
-  // other cases should not be possible, but don't do anything
-}
-
-void
-Ccnb::appendData (std::ostream &os, const Data &data)
-{
-  if (!data.getSignature ())
-    BOOST_THROW_EXCEPTION (error::wire::Ccnb ()
-                           << error::msg ("Signature is required, but not set"));
-
-  Ccnb::appendBlockHeader (os, Ccnb::CCN_DTAG_ContentObject, Ccnb::CCN_DTAG); // <ContentObject>
-
-  // necessary for now, because of the changed storage order
-  data.getSignature ()->doubleDispatch (os, *this, SIGNATURE_Block);
-
-  Ccnb::appendName (os, data.getName ());
-
-  Ccnb::appendBlockHeader (os, Ccnb::CCN_DTAG_SignedInfo, Ccnb::CCN_DTAG); // <SignedInfo>
-  data.getSignature ()->doubleDispatch (os, *this, SINATURE_INFO_PublisherPublicKeyDigest);
-
-  Ccnb::appendTimestampBlob (os, data.getContent ().getTimestamp ());
-
-  BOOST_ASSERT (sizeof (TYPES) == 3 * (static_cast<int> (Content::NACK)+1));
-  Ccnb::appendTaggedBlob (os, Ccnb::CCN_DTAG_Type, TYPES [data.getContent ().getType ()], 3);
-
-  if (data.getContent ().getFreshness () != Content::noFreshness)
-    {
-      Ccnb::appendTaggedNumber (os, Ccnb::CCN_DTAG_FreshnessSeconds,
-                                data.getContent ().getFreshness ().total_seconds ());
-    }
-
-  if (data.getContent ().getFinalBlockId () != Content::noFinalBlock)
-    {
-      Ccnb::appendTaggedBlob (os, Ccnb::CCN_DTAG_FinalBlockID, data.getContent ().getFinalBlockId ());
-    }
-
-  data.getSignature ()->doubleDispatch (os, *this, SINATURE_INFO_KeyLocator);
-  Ccnb::appendCloser (os); // </SignedInfo>
-
-  Ccnb::appendTaggedBlob (os, Ccnb::CCN_DTAG_Content, data.content ());
-
-  Ccnb::appendCloser (os); // </ContentObject>
-}
-
-} // namespace wire
-} // namespace ndn
diff --git a/ndn-cpp/encoding/ccnb.h b/ndn-cpp/encoding/ccnb.h
deleted file mode 100644
index fdc1b57..0000000
--- a/ndn-cpp/encoding/ccnb.h
+++ /dev/null
@@ -1,362 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Alexander Afanasyev
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDN_WIRE_CCNB_H
-#define NDN_WIRE_CCNB_H
-
-#include "base.h"
-
-#include "ndn-cpp/interest.h"
-#include "ndn-cpp/data.h"
-
-namespace ndn {
-namespace wire {
-
-/**
- * @brief Class for working with ccnb encoding
- */
-class Ccnb : public Base
-{
-public:
-  /**
-   * \brief Type tag for a ccnb start marker.
-   *
-   * \see http://www.ccnx.org/releases/latest/doc/technical/DTAG.html
-   */
-  enum ccn_tt {
-    CCN_EXT,        /**< starts composite extension - numval is subtype */
-    CCN_TAG,        /**< starts composite - numval is tagnamelen-1 */
-    CCN_DTAG,       /**< starts composite - numval is tagdict index (enum ccn_dtag) */
-    CCN_ATTR,       /**< attribute - numval is attrnamelen-1, value follows */
-    CCN_DATTR,      /**< attribute numval is attrdict index */
-    CCN_BLOB,       /**< opaque binary data - numval is byte count */
-    CCN_UDATA,      /**< UTF-8 encoded character data - numval is byte count */
-    CCN_NO_TOKEN    /**< should not occur in encoding */
-  };
-
-  /** \brief CCN_CLOSE_TAG terminates composites */
-  enum {CCN_CLOSE_TAG = 0};
-
-  /**
-   * \brief DTAG identifies ccnb-encoded elements.
-   *
-   * \see http://www.ccnx.org/releases/latest/doc/technical/DTAG.html
-   */
-  enum ccn_dtag {
-    CCN_DTAG_Any = 13,
-    CCN_DTAG_Name = 14,
-    CCN_DTAG_Component = 15,
-    CCN_DTAG_Certificate = 16,
-    CCN_DTAG_Collection = 17,
-    CCN_DTAG_CompleteName = 18,
-    CCN_DTAG_Content = 19,
-    CCN_DTAG_SignedInfo = 20,
-    CCN_DTAG_ContentDigest = 21,
-    CCN_DTAG_ContentHash = 22,
-    CCN_DTAG_Count = 24,
-    CCN_DTAG_Header = 25,
-    CCN_DTAG_Interest = 26,	/* 20090915 */
-    CCN_DTAG_Key = 27,
-    CCN_DTAG_KeyLocator = 28,
-    CCN_DTAG_KeyName = 29,
-    CCN_DTAG_Length = 30,
-    CCN_DTAG_Link = 31,
-    CCN_DTAG_LinkAuthenticator = 32,
-    CCN_DTAG_NameComponentCount = 33,	/* DeprecatedInInterest */
-    CCN_DTAG_RootDigest = 36,
-    CCN_DTAG_Signature = 37,
-    CCN_DTAG_Start = 38,
-    CCN_DTAG_Timestamp = 39,
-    CCN_DTAG_Type = 40,
-    CCN_DTAG_Nonce = 41,
-    CCN_DTAG_Scope = 42,
-    CCN_DTAG_Exclude = 43,
-    CCN_DTAG_Bloom = 44,
-    CCN_DTAG_BloomSeed = 45,
-    CCN_DTAG_AnswerOriginKind = 47,
-    CCN_DTAG_InterestLifetime = 48,
-    CCN_DTAG_Witness = 53,
-    CCN_DTAG_SignatureBits = 54,
-    CCN_DTAG_DigestAlgorithm = 55,
-    CCN_DTAG_BlockSize = 56,
-    CCN_DTAG_FreshnessSeconds = 58,
-    CCN_DTAG_FinalBlockID = 59,
-    CCN_DTAG_PublisherPublicKeyDigest = 60,
-    CCN_DTAG_PublisherCertificateDigest = 61,
-    CCN_DTAG_PublisherIssuerKeyDigest = 62,
-    CCN_DTAG_PublisherIssuerCertificateDigest = 63,
-    CCN_DTAG_ContentObject = 64,	/* 20090915 */
-    CCN_DTAG_WrappedKey = 65,
-    CCN_DTAG_WrappingKeyIdentifier = 66,
-    CCN_DTAG_WrapAlgorithm = 67,
-    CCN_DTAG_KeyAlgorithm = 68,
-    CCN_DTAG_Label = 69,
-    CCN_DTAG_EncryptedKey = 70,
-    CCN_DTAG_EncryptedNonceKey = 71,
-    CCN_DTAG_WrappingKeyName = 72,
-    CCN_DTAG_Action = 73,
-    CCN_DTAG_FaceID = 74,
-    CCN_DTAG_IPProto = 75,
-    CCN_DTAG_Host = 76,
-    CCN_DTAG_Port = 77,
-    CCN_DTAG_MulticastInterface = 78,
-    CCN_DTAG_ForwardingFlags = 79,
-    CCN_DTAG_FaceInstance = 80,
-    CCN_DTAG_ForwardingEntry = 81,
-    CCN_DTAG_MulticastTTL = 82,
-    CCN_DTAG_MinSuffixComponents = 83,
-    CCN_DTAG_MaxSuffixComponents = 84,
-    CCN_DTAG_ChildSelector = 85,
-    CCN_DTAG_RepositoryInfo = 86,
-    CCN_DTAG_Version = 87,
-    CCN_DTAG_RepositoryVersion = 88,
-    CCN_DTAG_GlobalPrefix = 89,
-    CCN_DTAG_LocalName = 90,
-    CCN_DTAG_Policy = 91,
-    CCN_DTAG_Namespace = 92,
-    CCN_DTAG_GlobalPrefixName = 93,
-    CCN_DTAG_PolicyVersion = 94,
-    CCN_DTAG_KeyValueSet = 95,
-    CCN_DTAG_KeyValuePair = 96,
-    CCN_DTAG_IntegerValue = 97,
-    CCN_DTAG_DecimalValue = 98,
-    CCN_DTAG_StringValue = 99,
-    CCN_DTAG_BinaryValue = 100,
-    CCN_DTAG_NameValue = 101,
-    CCN_DTAG_Entry = 102,
-    CCN_DTAG_ACL = 103,
-    CCN_DTAG_ParameterizedName = 104,
-    CCN_DTAG_Prefix = 105,
-    CCN_DTAG_Suffix = 106,
-    CCN_DTAG_Root = 107,
-    CCN_DTAG_ProfileName = 108,
-    CCN_DTAG_Parameters = 109,
-    CCN_DTAG_InfoString = 110,
-    CCN_DTAG_StatusResponse = 112,
-    CCN_DTAG_StatusCode = 113,
-    CCN_DTAG_StatusText = 114,
-    CCN_DTAG_SyncNode = 115,
-    CCN_DTAG_SyncNodeKind = 116,
-    CCN_DTAG_SyncNodeElement = 117,
-    CCN_DTAG_SyncVersion = 118,
-    CCN_DTAG_SyncNodeElements = 119,
-    CCN_DTAG_SyncContentHash = 120,
-    CCN_DTAG_SyncLeafCount = 121,
-    CCN_DTAG_SyncTreeDepth = 122,
-    CCN_DTAG_SyncByteCount = 123,
-    CCN_DTAG_SyncConfigSlice = 124,
-    CCN_DTAG_SyncConfigSliceList = 125,
-    CCN_DTAG_SyncConfigSliceOp = 126,
-    CCN_DTAG_SyncNodeDeltas = 127,
-    CCN_DTAG_SequenceNumber = 256,
-    CCN_DTAG_CCNProtocolDataUnit = 17702112
-  };
-
-
-  /**
-   * @brief Append CCNB block header
-   * @param os output stream to write
-   * @param value dictionary id of the block header
-   * @param block_type Type of CCNB block
-   */
-  static void
-  appendBlockHeader (std::ostream &os, size_t value, ccn_tt block_type);
-
-  /**
-   * @brief Add number in CCNB encoding
-   * @param os output stream to write
-   * @param number Number to be written
-   *
-   * @returns written length
-   */
-  static void
-  appendNumber (std::ostream &os, uint32_t number);
-
-  /**
-   * @brief Append CCNB closer tag (size is 1)
-   * @param os output stream to write
-   */
-  inline static void
-  appendCloser (std::ostream &os);
-
-  /**
-   * @brief Append Name in CCNB encoding
-   * @param os output stream to write
-   * @param name constant reference to Name object
-   *
-   * @returns written length
-   */
-  static void
-  appendName (std::ostream &os, const Name &name);
-
-  /**
-   * Append a binary timestamp as a BLOB using the ccn binary
-   * Timestamp representation (12-bit fraction).
-   *
-   * @param os output stream to write
-   * @param time reference to time duration object
-   */
-  static void
-  appendTimestampBlob (std::ostream &os, const TimeInterval &timestamp);
-
-  /**
-   * Append a binary timestamp as a BLOB using the ccn binary
-   * Timestamp representation (12-bit fraction).
-   *
-   * @param os output stream to write
-   * @param time reference to Time (posix_time::ptime) object.
-   *             This method automatically calculates duration between time and gregorian::date(1970,1,1)
-   *             and calls the other version of the method
-   */
-  inline static void
-  appendTimestampBlob (std::ostream &os, const Time &time);
-
-  /**
-   * Append a tagged BLOB
-   *
-   * This is a ccnb-encoded element with containing the BLOB as content
-   *
-   * @param os output stream to write
-   * @param dtag is the element's dtag
-   * @param data points to the binary data
-   * @param size is the size of the data, in bytes
-   */
-  inline static void
-  appendTaggedBlob (std::ostream &os, ccn_dtag dtag, const void *data, size_t size);
-
-  /**
-   * Append a tagged BLOB
-   *
-   * This is a ccnb-encoded element with containing the BLOB as content
-   *
-   * @param os output stream to write
-   * @param dtag is the element's dtag
-   * @param blob reference to the data blob
-   */
-  inline static void
-  appendTaggedBlob (std::ostream &os, ccn_dtag dtag, const Blob &blob);
-
-  /**
-   * Append a tagged BLOB
-   *
-   * This is a ccnb-encoded element with containing the BLOB as content
-   *
-   * @param os output stream to write
-   * @param dtag is the element's dtag
-   * @param data points to the binary data
-   * @param size is the size of the data, in bytes
-   */
-  inline static void
-  appendTaggedNumber (std::ostream &os, ccn_dtag dtag, uint32_t number);
-
-  /**
-   * Append a tagged string (should be a valid UTF-8 coded string)
-   *
-   * This is a ccnb-encoded element with containing UDATA as content
-   *
-   * @param os output stream to write
-   * @param dtag is the element's dtag
-   * @param string UTF-8 string to be written
-   */
-  inline static void
-  appendString (std::ostream &os, ccn_dtag dtag, const std::string &string);
-
-  /**
-   * @brief Format interest in CCNb encoding
-   * @param os output stream to write
-   * @param interest Interest to be formatted
-   *
-   * @todo For now, this method is used to create Interest template, which doesn't output name to the stream
-   */
-  static void
-  appendInterest (std::ostream &os, const Interest &interest);
-
-  /**
-   * @brief Append exclude filter in CCNb encoding
-   * @param os output stream to write
-   * @param exclude Exclude filter to be formatted
-   */
-  static void
-  appendExclude (std::ostream &os, const Exclude &exclude);
-
-  /**
-   * @brief Append signature in SHA256withRSA format
-   */
-  virtual void
-  appendSignature (std::ostream &os, const signature::Sha256WithRsa &signature, void *userData);
-
-  /**
-   * @brief Format data in CCNb encoding
-   * @param os output stream to write
-   * @param data data to be formatted
-   */
-  void
-  appendData (std::ostream &os, const Data &data);
-};
-
-
-inline void
-Ccnb::appendCloser (std::ostream &os)
-{
-  os.put (Ccnb::CCN_CLOSE_TAG);
-}
-
-inline void
-Ccnb::appendTimestampBlob (std::ostream &os, const Time &time)
-{
-  appendTimestampBlob (os, time - time::UNIX_EPOCH_TIME);
-}
-
-inline void
-Ccnb::appendTaggedBlob (std::ostream &os, Ccnb::ccn_dtag dtag, const void *data, size_t size)
-{
-  appendBlockHeader (os, dtag, Ccnb::CCN_DTAG);
-  /* 2 */
-  if (size>0)
-    {
-      appendBlockHeader (os, size, Ccnb::CCN_BLOB);
-      os.write (reinterpret_cast<const char*> (data), size);
-      /* size */
-    }
-  appendCloser (os);
-  /* 1 */
-}
-
-inline void
-Ccnb::appendTaggedBlob (std::ostream &os, ccn_dtag dtag, const Blob &blob)
-{
-  appendTaggedBlob (os, dtag, blob.buf (), blob.size ());
-}
-
-inline void
-Ccnb::appendTaggedNumber (std::ostream &os, Ccnb::ccn_dtag dtag, uint32_t number)
-{
-  appendBlockHeader (os, dtag, Ccnb::CCN_DTAG);
-  {
-    appendNumber (os, number);
-  }
-  appendCloser (os);
-}
-
-inline void
-Ccnb::appendString (std::ostream &os, Ccnb::ccn_dtag dtag, const std::string &string)
-{
-  appendBlockHeader (os, dtag, Ccnb::CCN_DTAG);
-  {
-    appendBlockHeader (os, string.size (), Ccnb::CCN_UDATA);
-    os.write (string.c_str (), string.size ());
-  }
-  appendCloser (os);
-}
-
-} // wire
-} // ndn
-
-#endif // NDN_WIRE_CCNB_H
diff --git a/ndn-cpp/interest.cc b/ndn-cpp/interest.cc
deleted file mode 100644
index 020a0ef..0000000
--- a/ndn-cpp/interest.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Alexander Afanasyev
- *                     Zhenkai Zhu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- *         Zhenkai Zhu <zhenkai@cs.ucla.edu>
- */
-
-#include "interest.h"
-#include <boost/lexical_cast.hpp>
-
-using namespace std;
-
-namespace ndn {
-
-Interest::Interest ()
-  // m_name
-  : m_maxSuffixComponents (Interest::ncomps)
-  , m_minSuffixComponents (Interest::ncomps)
-  , m_answerOriginKind (AOK_DEFAULT)
-  , m_interestLifetime (time::Seconds (-1.0))
-  , m_scope (NO_SCOPE)
-  , m_childSelector (CHILD_DEFAULT)
-  // m_publisherKeyDigest
-{
-}
-
-Interest::Interest (const Name &name)
-  : m_name (name)
-  , m_maxSuffixComponents (Interest::ncomps)
-  , m_minSuffixComponents (Interest::ncomps)
-  , m_answerOriginKind(AOK_DEFAULT)
-  , m_interestLifetime (time::Seconds (-1.0))
-  , m_scope (NO_SCOPE)
-  , m_childSelector (CHILD_DEFAULT)
-  // m_publisherKeyDigest
-{
-}
-
-Interest::Interest (const Interest &other)
-{
-  m_name = other.m_name;
-  m_maxSuffixComponents = other.m_maxSuffixComponents;
-  m_minSuffixComponents = other.m_minSuffixComponents;
-  m_answerOriginKind = other.m_answerOriginKind;
-  m_interestLifetime = other.m_interestLifetime;
-  m_scope = other.m_scope;
-  m_childSelector = other.m_childSelector;
-  m_publisherPublicKeyDigest = other.m_publisherPublicKeyDigest;
-}
-
-bool
-Interest::operator == (const Interest &other)
-{
-  return
-       m_name == other.m_name
-    && m_maxSuffixComponents == other.m_maxSuffixComponents
-    && m_minSuffixComponents == other.m_minSuffixComponents
-    && m_answerOriginKind == other.m_answerOriginKind
-    && m_interestLifetime == other.m_interestLifetime
-    && m_scope == other.m_scope
-    && m_childSelector == other.m_childSelector;
-}
-
-} // ndn
diff --git a/ndn-cpp/interest.h b/ndn-cpp/interest.h
deleted file mode 100644
index ace9847..0000000
--- a/ndn-cpp/interest.h
+++ /dev/null
@@ -1,451 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Alexander Afanasyev
- *                     Zhenkai Zhu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- *         Zhenkai Zhu <zhenkai@cs.ucla.edu>
- */
-
-#ifndef NDN_INTEREST_H
-#define NDN_INTEREST_H
-
-#include <ndn-cpp/common.h>
-#include <ndn-cpp/fields/name.h>
-#include <ndn-cpp/fields/exclude.h>
-#include <ndn-cpp/helpers/hash.h>
-
-namespace ndn {
-
-class Interest;
-/**
- * @brief Class abstracting operations with Interests (constructing and getting access to Interest fields)
- */
-class Interest
-{
-public:
-  /**
-   * @brief Default constructor, creates an interest for / prefix without any selectors
-   */
-  Interest ();
-
-  /**
-   * @brief Create an interest for the name
-   * @param name name of the data to request
-   */
-  Interest (const Name &name);
-
-  /**
-   * @brief Copy constructor
-   * @param interest interest to copy
-   */
-  Interest (const Interest &interest);
-
-  /**
-   * @brief Set interest name
-   * @param name name of the interest
-   * @return reference to self (to allow method chaining)
-   *
-   * In some cases, a direct access to and manipulation of name using getName is more efficient
-   */
-  inline Interest &
-  setName (const Name &name);
-
-  /**
-   * @brief Get interest name (const reference)
-   * @returns name of the interest
-   */
-  inline const Name &
-  getName () const;
-
-  /**
-   * @brief Get interest name (reference)
-   * @returns name of the interest
-   */
-  inline Name &
-  getName ();
-
-  /**
-   * @brief Set interest lifetime (time_duration)
-   * @param interestLifetime interest lifetime specified as a time_duration value.
-   *        Negative value means that InterestLifetime is not set.
-   * @return reference to self (to allow method chaining)
-   */
-  inline Interest &
-  setInterestLifetime (const TimeInterval &interestLifetime);
-
-  /**
-   * @brief Set interest lifetime (double)
-   * @param interestLifetime interest lifetime expressed in seconds, with possible fractional seconds (double).
-   *        Negative value means that InterestLifetime is not set.
-   * @return reference to self (to allow method chaining)
-   */
-  inline Interest &
-  setInterestLifetime (double interestLifetimeSeconds);
-
-  /**
-   * @brief Get interest lifetime
-   * @return TimeInterval representing lifetime of the interest.
-   *         Use time_duration::total_seconds () or time_duration::total_microseconds (),
-   *         if you need interest lifetime as a plain number.
-   *         @see http://www.boost.org/doc/libs/1_53_0/doc/html/date_time/posix_time.html
-   */
-  inline const TimeInterval &
-  getInterestLifetime () const;
-
-  /**
-   * @brief Set intended interest scope
-   * @param scope requested scope of the interest @see Scope
-   * @return reference to self (to allow method chaining)
-   */
-  inline Interest &
-  setScope (uint8_t scope);
-
-  /**
-   * @brief Get intended interest scope
-   * @return intended interest scope @see Scope
-   */
-  inline uint8_t
-  getScope () const;
-
-  ///////////////////////////////////////////////////////////////////////
-  //                          SELECTORS                                //
-  ///////////////////////////////////////////////////////////////////////
-
-  /**
-   * @brief Enum defining constants for AnswerOriginKind selector field
-   */
-  enum AnswerOriginKind
-  {
-    AOK_CS = 0x1,      ///< @brief request item from the content store
-    AOK_NEW = 0x2,     ///< @brief request item from the original producer
-    AOK_DEFAULT = 0x3, ///< @brief default: either from content store or original producer
-    AOK_STALE = 0x4,   ///< @brief Allow stale data
-    AOK_EXPIRE = 0x10  ///< @brief Allow expired data (?)
-  };
-
-  /**
-   * @brief Enum defining constants for ChildSelector field
-   */
-  enum ChildSelector
-    {
-      CHILD_LEFT = 0,   ///< @brief request left child
-      CHILD_RIGHT = 1,  ///< @brief request right child
-      CHILD_DEFAULT = 2 ///< @brief do not specify which child is requested
-    };
-
-  /**
-   * @brief Enum defining constants for Scope field
-   */
-  enum Scope
-    {
-      NO_SCOPE = 255,        ///< @brief Interest scope is not defined
-      SCOPE_LOCAL_CCND = 0,  ///< @brief Interest scope is only toward local NDN daemon
-      SCOPE_LOCAL_HOST = 1,  ///< @brief Interest scope is within local host (any local application only)
-      SCOPE_NEXT_HOST = 2    ///< @brief Interest scope is within local host and immediate neighboring node
-    };
-
-  /**
-   * @brief Set interest selector for maximum suffix components
-   * @param maxSuffixComponents maximum number of suffix components. If Interest::ncomps, then not restricted
-   * @return reference to self (to allow method chaining)
-   */
-  inline Interest &
-  setMaxSuffixComponents (uint32_t maxSuffixComponents);
-
-  /**
-   * \brief Get interest selector for maximum suffix components
-   *
-   * MaxSuffixComponents refer to the number of name components beyond those in the prefix,
-   * and counting the implicit digest, that may occur in the matching ContentObject.
-   * For more information, see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html
-   **/
-  inline uint32_t
-  getMaxSuffixComponents () const;
-
-  /**
-   * @brief Set interest selector for minimum suffix components
-   * @param minSuffixComponents minimum number of suffix components. If Interest::ncomps, then not restricted
-   * @return reference to self (to allow method chaining)
-   */
-  inline Interest &
-  setMinSuffixComponents (uint32_t minSuffixComponents);
-
-  /**
-   * \brief Get interest selector for minimum suffix components
-   *
-   * MinSuffixComponents refer to the number of name components beyond those in the prefix,
-   * and counting the implicit digest, that may occur in the matching ContentObject.
-   * For more information, see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html
-   **/
-  inline uint32_t
-  getMinSuffixComponents () const;
-
-  /**
-   * @brief Set interest selector for answer origin kind
-   * @param answerOriginKind type of answer @see AnswerOriginKind
-   * @return reference to self (to allow method chaining)
-   */
-  inline Interest &
-  setAnswerOriginKind (uint32_t answerOriginKind);
-
-  /**
-   * @brief Get interest selector for answer origin kind
-   */
-  inline uint32_t
-  getAnswerOriginKind () const;
-
-  /**
-   * @brief Set interest selector for child selector
-   * @param child child selector @see ChildSelector
-   * @return reference to self (to allow method chaining)
-   *
-   * Often a given interest will match more than one ContentObject within a given content store.
-   * The ChildSelector provides a way of expressing a preference for which of these should be returned.
-   * If the value is false, the leftmost child is preferred. If true, the rightmost child is preferred.
-   * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information.
-   */
-  inline Interest &
-  setChildSelector (uint8_t child);
-
-  /**
-   * @brief Get interest selector for child selector
-   */
-  inline uint8_t
-  getChildSelector () const;
-
-  /**
-   * @brief Set interest selector for publisher public key digest
-   * @param digest publisher public key digest
-   * @return reference to self (to allow method chaining)
-   *
-   * Currently, this method has no effect
-   * @todo Implement PublisherPublicKeyDigest
-   */
-  inline Interest &
-  setPublisherPublicKeyDigest(const Hash &digest);
-
-  /**
-   * @brief Get interest selector for publisher public key digest
-   *
-   * @todo Implement
-   */
-  inline const Hash&
-  getPublisherPublicKeyDigest () const;
-
-  /**
-   * @brief Set exclude filter
-   * @param exclude An exclude filter to set
-   *
-   * In some cases, a direct access to and manipulation of exclude filter using getExclude is more efficient
-   */
-  inline void
-  setExclude (const Exclude &exclude);
-
-  /**
-   * @brief Get exclude filter (const reference)
-   */
-  inline const Exclude &
-  getExclude () const;
-
-  /**
-   * @brief Get exclude filter (reference)
-   */
-  inline Exclude &
-  getExclude ();
-
-  ///////////////////////////////////////////////////////////////////////
-  //                           HELPERS                                 //
-  ///////////////////////////////////////////////////////////////////////
-
-  /**
-   * @brief Compare equality of two interests
-   */
-  bool
-  operator== (const Interest &interest);
-
-public:
-  // Data Members (public):
-  /// @brief Value indicating that number of components parameter is invalid
-  const static uint32_t ncomps = static_cast<uint32_t> (-1);
-
-private:
-  Name m_name;
-  uint32_t m_maxSuffixComponents;
-  uint32_t m_minSuffixComponents;
-  uint32_t m_answerOriginKind;
-  TimeInterval m_interestLifetime; // lifetime in seconds
-
-  uint8_t m_scope;
-  uint8_t m_childSelector;
-  // not used now
-  Hash m_publisherPublicKeyDigest;
-  Exclude m_exclude;
-
-  ptr_lib::shared_ptr<Blob> m_wire;
-};
-
-namespace Error
-{
-/**
- * @brief Exception that is thrown in case of error during interest construction or parsing
- */
-struct Interest:
-    virtual boost::exception, virtual std::exception {};
-}
-
-
-
-inline Interest &
-Interest::setName (const Name &name)
-{
-  m_name = name;
-  return *this;
-}
-
-inline const Name &
-Interest::getName () const
-{
-  return m_name;
-}
-
-inline Name &
-Interest::getName ()
-{
-  return m_name;
-}
-
-inline Interest &
-Interest::setInterestLifetime (const TimeInterval &interestLifetime)
-{
-  m_interestLifetime = interestLifetime;
-  return *this;
-}
-
-inline Interest &
-Interest::setInterestLifetime (double interestLifetimeSeconds)
-{
-  m_interestLifetime = time::Seconds (interestLifetimeSeconds);
-  return *this;
-}
-
-inline const TimeInterval &
-Interest::getInterestLifetime () const
-{
-  return m_interestLifetime;
-}
-
-inline Interest &
-Interest::setScope (uint8_t scope)
-{
-  m_scope = scope;
-  return *this;
-}
-
-inline uint8_t
-Interest::getScope () const
-{
-  return m_scope;
-}
-
-///////////////////////////////////////////////////////////////////////
-//                          SELECTORS                                //
-///////////////////////////////////////////////////////////////////////
-
-
-inline Interest &
-Interest::setMaxSuffixComponents (uint32_t maxSuffixComponents)
-{
-  m_maxSuffixComponents = maxSuffixComponents;
-  return *this;
-}
-
-inline uint32_t
-Interest::getMaxSuffixComponents () const
-{
-  return m_maxSuffixComponents;
-}
-
-inline Interest &
-Interest::setMinSuffixComponents (uint32_t minSuffixComponents)
-{
-  m_minSuffixComponents = minSuffixComponents;
-  return *this;
-}
-
-inline uint32_t
-Interest::getMinSuffixComponents () const
-{
-  return m_minSuffixComponents;
-}
-
-inline Interest &
-Interest::setAnswerOriginKind (uint32_t answerOriginKind)
-{
-  m_answerOriginKind = answerOriginKind;
-  return *this;
-}
-
-inline uint32_t
-Interest::getAnswerOriginKind () const
-{
-  return m_answerOriginKind;
-}
-
-inline Interest &
-Interest::setChildSelector (uint8_t childSelector)
-{
-  m_childSelector = childSelector;
-  return *this;
-}
-
-inline uint8_t
-Interest::getChildSelector () const
-{
-  return m_childSelector;
-}
-
-inline Interest &
-Interest::setPublisherPublicKeyDigest(const Hash &publisherPublicKeyDigest)
-{
-  m_publisherPublicKeyDigest = publisherPublicKeyDigest;
-  return *this;
-}
-
-inline const Hash&
-Interest::getPublisherPublicKeyDigest () const
-{
-  return m_publisherPublicKeyDigest;
-}
-
-inline void
-Interest::setExclude (const Exclude &exclude)
-{
-  m_exclude = exclude;
-}
-
-/**
- * @brief Get exclude filter (const reference)
- */
-inline const Exclude &
-Interest::getExclude () const
-{
-  return m_exclude;
-}
-
-/**
- * @brief Get exclude filter (reference)
- */
-inline Exclude &
-Interest::getExclude ()
-{
-  return m_exclude;
-}
-
-
-} // ndn
-
-#endif // NDN_INTEREST_H
