diff --git a/src/data.cpp b/src/data.cpp
index 84dbbd6..9e5effe 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -22,12 +22,12 @@
 #include "data.hpp"
 #include "encoding/block-helpers.hpp"
 #include "util/crypto.hpp"
-#include "util/concepts.hpp"
 
 namespace ndn {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Data>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Data>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Data>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Data>));
 static_assert(std::is_base_of<tlv::Error, Data::Error>::value,
               "Data::Error must inherit from tlv::Error");
@@ -94,11 +94,11 @@
 
 
 template size_t
-Data::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block,
+Data::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder,
                                        bool unsignedPortion) const;
 
 template size_t
-Data::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block,
+Data::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder,
                                          bool unsignedPortion) const;
 
 
@@ -230,10 +230,10 @@
 Data::getContent() const
 {
   if (m_content.empty())
-    m_content = dataBlock(tlv::Content, reinterpret_cast<const uint8_t*>(0), 0);
+    m_content = makeEmptyBlock(tlv::Content);
 
   if (!m_content.hasWire())
-      m_content.encode();
+    m_content.encode();
   return m_content;
 }
 
@@ -242,7 +242,7 @@
 {
   onChanged();
 
-  m_content = dataBlock(tlv::Content, content, contentLength);
+  m_content = makeBinaryBlock(tlv::Content, content, contentLength);
 
   return *this;
 }
diff --git a/src/data.hpp b/src/data.hpp
index b12061b..b5e1c02 100644
--- a/src/data.hpp
+++ b/src/data.hpp
@@ -91,7 +91,7 @@
   /**
    * @brief Fast encoding or block size estimation
    *
-   * @param block                   EncodingEstimator or EncodingBuffer instance
+   * @param encoder                 EncodingEstimator or EncodingBuffer instance
    * @param wantUnsignedPortionOnly Request only unsigned portion to be encoded in block.
    *                                If true, only Name, MetaInfo, Content, and SignatureInfo
    *                                blocks will be encoded into the block. Note that there
@@ -99,7 +99,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block, bool wantUnsignedPortionOnly = false) const;
+  wireEncode(EncodingImpl<TAG>& encoder, bool wantUnsignedPortionOnly = false) const;
 
   /**
    * @brief Encode to a wire format
diff --git a/src/encoding/block-helpers.cpp b/src/encoding/block-helpers.cpp
new file mode 100644
index 0000000..594fc5c
--- /dev/null
+++ b/src/encoding/block-helpers.cpp
@@ -0,0 +1,161 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, 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.
+ */
+
+#include "block-helpers.hpp"
+
+namespace ndn {
+namespace encoding {
+
+template<Tag TAG>
+size_t
+prependNonNegativeIntegerBlock(EncodingImpl<TAG>& encoder, uint32_t type, uint64_t value)
+{
+  size_t valueLength = encoder.prependNonNegativeInteger(value);
+  size_t totalLength = valueLength;
+  totalLength += encoder.prependVarNumber(valueLength);
+  totalLength += encoder.prependVarNumber(type);
+
+  return totalLength;
+}
+
+template size_t
+prependNonNegativeIntegerBlock<EstimatorTag>(EncodingImpl<EstimatorTag>& encoder,
+                                             uint32_t type, uint64_t value);
+
+template size_t
+prependNonNegativeIntegerBlock<EncoderTag>(EncodingImpl<EncoderTag>& encoder,
+                                           uint32_t type, uint64_t value);
+
+
+Block
+makeNonNegativeIntegerBlock(uint32_t type, uint64_t value)
+{
+  EncodingEstimator estimator;
+  size_t totalLength = prependNonNegativeIntegerBlock(estimator, type, value);
+
+  EncodingBuffer encoder(totalLength, 0);
+  prependNonNegativeIntegerBlock(encoder, type, value);
+
+  return encoder.block();
+}
+
+uint64_t
+readNonNegativeInteger(const Block& block)
+{
+  Buffer::const_iterator begin = block.value_begin();
+  return tlv::readNonNegativeInteger(block.value_size(), begin, block.value_end());
+}
+
+////////
+
+template<Tag TAG>
+size_t
+prependEmptyBlock(EncodingImpl<TAG>& encoder, uint32_t type)
+{
+  size_t totalLength = encoder.prependVarNumber(0);
+  totalLength += encoder.prependVarNumber(type);
+
+  return totalLength;
+}
+
+template size_t
+prependEmptyBlock<EstimatorTag>(EncodingImpl<EstimatorTag>& encoder, uint32_t type);
+
+template size_t
+prependEmptyBlock<EncoderTag>(EncodingImpl<EncoderTag>& encoder, uint32_t type);
+
+
+Block
+makeEmptyBlock(uint32_t type)
+{
+  EncodingEstimator estimator;
+  size_t totalLength = prependEmptyBlock(estimator, type);
+
+  EncodingBuffer encoder(totalLength, 0);
+  prependEmptyBlock(encoder, type);
+
+  return encoder.block();
+}
+
+////////
+
+template<Tag TAG>
+size_t
+prependStringBlock(EncodingImpl<TAG>& encoder, uint32_t type, const std::string& value)
+{
+  size_t valueLength = encoder.prependByteArray(reinterpret_cast<const uint8_t*>(value.data()),
+                                                value.size());
+  size_t totalLength = valueLength;
+  totalLength += encoder.prependVarNumber(valueLength);
+  totalLength += encoder.prependVarNumber(type);
+
+  return totalLength;
+}
+
+template size_t
+prependStringBlock<EstimatorTag>(EncodingImpl<EstimatorTag>& encoder,
+                                 uint32_t type, const std::string& value);
+
+template size_t
+prependStringBlock<EncoderTag>(EncodingImpl<EncoderTag>& encoder,
+                               uint32_t type, const std::string& value);
+
+
+Block
+makeStringBlock(uint32_t type, const std::string& value)
+{
+  EncodingEstimator estimator;
+  size_t totalLength = prependStringBlock(estimator, type, value);
+
+  EncodingBuffer encoder(totalLength, 0);
+  prependStringBlock(encoder, type, value);
+
+  return encoder.block();
+}
+
+std::string
+readString(const Block& block)
+{
+  return std::string(reinterpret_cast<const char*>(block.value()), block.value_size());
+}
+
+////////
+
+Block
+makeBinaryBlock(uint32_t type, const uint8_t* value, size_t length)
+{
+  EncodingEstimator estimator;
+  size_t totalLength = estimator.prependByteArrayBlock(type, value, length);
+
+  EncodingBuffer encoder(totalLength, 0);
+  encoder.prependByteArrayBlock(type, value, length);
+
+  return encoder.block();
+}
+
+Block
+makeBinaryBlock(uint32_t type, const char* value, size_t length)
+{
+  return makeBinaryBlock(type, reinterpret_cast<const uint8_t*>(value), length);
+}
+
+} // namespace encoding
+} // namespace ndn
diff --git a/src/encoding/block-helpers.hpp b/src/encoding/block-helpers.hpp
index e3e86f4..5f26b17 100644
--- a/src/encoding/block-helpers.hpp
+++ b/src/encoding/block-helpers.hpp
@@ -24,115 +24,90 @@
 
 #include "block.hpp"
 #include "encoding-buffer.hpp"
+#include "../util/concepts.hpp"
 
 #include <iterator>
 
 namespace ndn {
+namespace encoding {
 
 /**
- * @deprecated Use Encoder::prependBlock and Estimator::prependBlock instead
+ * @brief Helper to prepend TLV block type @p type containing non-negative integer @p value
+ * @see makeNonNegativeIntegerBlock, readNonNegativeInteger
  */
-template<bool P>
-inline size_t
-prependBlock(EncodingImpl<P>& encoder, const Block& block)
-{
-  return encoder.prependBlock(block);
-}
+template<Tag TAG>
+size_t
+prependNonNegativeIntegerBlock(EncodingImpl<TAG>& encoder, uint32_t type, uint64_t value);
 
 /**
- * @deprecated Use Encoder::prependByteArrayBlock and Estimator::prependByteArrayBlock instead
+ * @brief Create a TLV block type @p type containing non-negative integer @p value
+ * @see prependNonNegativeIntegerBlock, readNonNegativeInteger
  */
-template<bool P>
-inline size_t
-prependByteArrayBlock(EncodingImpl<P>& encoder,
-                      uint32_t type, const uint8_t* array, size_t arraySize)
-{
-  return encoder.prependByteArrayBlock(type, array, arraySize);
-}
+Block
+makeNonNegativeIntegerBlock(uint32_t type, uint64_t value);
 
-template<bool P>
-inline size_t
-prependNonNegativeIntegerBlock(EncodingImpl<P>& encoder, uint32_t type, uint64_t number)
-{
-  size_t valueLength = encoder.prependNonNegativeInteger(number);
-  size_t totalLength = valueLength;
-  totalLength += encoder.prependVarNumber(valueLength);
-  totalLength += encoder.prependVarNumber(type);
+/**
+ * @brief Helper to read a non-negative integer from a block
+ * @see prependNonNegativeIntegerBlock, makeNonNegativeIntegerBlock
+ * @throw tlv::Error if block does not contain a valid nonNegativeInteger
+ */
+uint64_t
+readNonNegativeInteger(const Block& block);
 
-  return totalLength;
-}
+////////
 
-template<bool P>
-inline size_t
-prependBooleanBlock(EncodingImpl<P>& encoder, uint32_t type)
-{
-  size_t totalLength = encoder.prependVarNumber(0);
-  totalLength += encoder.prependVarNumber(type);
+/**
+ * @brief Helper to prepend TLV block type @p type containing no value (i.e., a boolean block)
+ * @see makeEmptyBlock
+ */
+template<Tag TAG>
+size_t
+prependEmptyBlock(EncodingImpl<TAG>& encoder, uint32_t type);
 
-  return totalLength;
-}
+/**
+ * @brief Create a TLV block type @p type containing no value (i.e., a boolean block)
+ * @see prependEmptyBlock
+ */
+Block
+makeEmptyBlock(uint32_t type);
 
-template<bool P, class U>
-inline size_t
-prependNestedBlock(EncodingImpl<P>& encoder, uint32_t type, const U& nestedBlock)
-{
-  size_t valueLength = nestedBlock.wireEncode(encoder);
-  size_t totalLength = valueLength;
-  totalLength += encoder.prependVarNumber(valueLength);
-  totalLength += encoder.prependVarNumber(type);
+////////
 
-  return totalLength;
-}
+/**
+ * @brief Helper to prepend TLV block type @p type with value from a string @p value
+ * @see makeStringBlock, readString
+ */
+template<Tag TAG>
+size_t
+prependStringBlock(EncodingImpl<TAG>& encoder, uint32_t type, const std::string& value);
 
+/**
+ * @brief Create a TLV block type @p type with value from a string @p
+ * @see prependStringBlock, readString
+ */
+Block
+makeStringBlock(uint32_t type, const std::string& value);
 
-inline Block
-nonNegativeIntegerBlock(uint32_t type, uint64_t value)
-{
-  EncodingEstimator estimator;
-  size_t totalLength = prependNonNegativeIntegerBlock(estimator, type, value);
+/**
+ * @brief Helper to read a string value from a block
+ * @see prependStringBlock, makeStringBlock
+ */
+std::string
+readString(const Block& block);
 
-  EncodingBuffer encoder(totalLength, 0);
-  prependNonNegativeIntegerBlock(encoder, type, value);
+////////
 
-  return encoder.block();
-}
+/**
+ * @brief Create a TLV block type @p type with value from a buffer @p value of size @p length
+ */
+Block
+makeBinaryBlock(uint32_t type, const uint8_t* value, size_t length);
 
-inline uint64_t
-readNonNegativeInteger(const Block& block)
-{
-  Buffer::const_iterator begin = block.value_begin();
-  return tlv::readNonNegativeInteger(block.value_size(), begin, block.value_end());
-}
-
-inline Block
-booleanBlock(uint32_t type)
-{
-  EncodingEstimator estimator;
-  size_t totalLength = prependBooleanBlock(estimator, type);
-
-  EncodingBuffer encoder(totalLength, 0);
-  prependBooleanBlock(encoder, type);
-
-  return encoder.block();
-}
-
-inline Block
-dataBlock(uint32_t type, const uint8_t* data, size_t dataSize)
-{
-  EncodingEstimator estimator;
-  size_t totalLength = estimator.prependByteArrayBlock(type, data, dataSize);
-
-  EncodingBuffer encoder(totalLength, 0);
-  encoder.prependByteArrayBlock(type, data, dataSize);
-
-  return encoder.block();
-}
-
-inline Block
-dataBlock(uint32_t type, const char* data, size_t dataSize)
-{
-  return dataBlock(type, reinterpret_cast<const uint8_t*>(data), dataSize);
-}
+/**
+ * @brief Create a TLV block type @p type with value from a buffer @p value of size @p length
+ */
+Block
+makeBinaryBlock(uint32_t type, const char* value, size_t length);
 
 /**
  * @brief Helper class template to create a data block when RandomAccessIterator is used
@@ -192,7 +167,7 @@
  */
 template<class Iterator>
 inline Block
-dataBlock(uint32_t type, Iterator first, Iterator last)
+makeBinaryBlock(uint32_t type, Iterator first, Iterator last)
 {
   static_assert(sizeof(typename std::iterator_traits<Iterator>::value_type) == 1,
                 "Iterator should point only to char or unsigned char");
@@ -206,6 +181,155 @@
   return DataBlock::makeBlock(type, first, last);
 }
 
+////////
+
+/**
+ * @brief Prepend a TLV block of type @p type with WireEncodable @p value as a value
+ * @tparam U type that satisfies WireEncodableWithEncodingBuffer concept
+ * @see makeNestedBlock
+ */
+template<Tag TAG, class U>
+inline size_t
+prependNestedBlock(EncodingImpl<TAG>& encoder, uint32_t type, const U& value)
+{
+  BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<U>));
+
+  size_t valueLength = value.wireEncode(encoder);
+  size_t totalLength = valueLength;
+  totalLength += encoder.prependVarNumber(valueLength);
+  totalLength += encoder.prependVarNumber(type);
+
+  return totalLength;
+}
+
+/**
+ * @brief Create a TLV block of type @p type with WireEncodable @p value as a value
+ * @tparam U type that satisfies WireEncodableWithEncodingBuffer concept
+ * @see prependNestedBlock
+ */
+template<class U>
+inline Block
+makeNestedBlock(uint32_t type, const U& value)
+{
+  EncodingEstimator estimator;
+  size_t totalLength = prependNestedBlock(estimator, type, value);
+
+  EncodingBuffer encoder(totalLength, 0);
+  prependNestedBlock(encoder, type, value);
+
+  return encoder.block();
+}
+
+#define NDN_CXX_ENABLE_DEPRECATED_BLOCK_HELPERS
+#ifdef NDN_CXX_ENABLE_DEPRECATED_BLOCK_HELPERS
+
+/**
+ * @deprecated Use Encoder::prependBlock and Estimator::prependBlock instead
+ */
+template<Tag TAG>
+inline size_t
+prependBlock(EncodingImpl<TAG>& encoder, const Block& block)
+{
+  return encoder.prependBlock(block);
+}
+
+/**
+ * @deprecated Use Encoder::prependByteArrayBlock and Estimator::prependByteArrayBlock instead
+ */
+template<Tag TAG>
+inline size_t
+prependByteArrayBlock(EncodingImpl<TAG>& encoder,
+                      uint32_t type, const uint8_t* array, size_t arraySize)
+{
+  return encoder.prependByteArrayBlock(type, array, arraySize);
+}
+
+/**
+ * @deprecated Use makeNonNegativeIntegerBlock instead
+ */
+inline Block
+nonNegativeIntegerBlock(uint32_t type, uint64_t value)
+{
+  return makeNonNegativeIntegerBlock(type, value);
+}
+
+/**
+ * @deprecated Use prependEmptyBlock instead
+ */
+template<Tag TAG>
+size_t
+prependBooleanBlock(EncodingImpl<TAG>& encoder, uint32_t type)
+{
+  return prependEmptyBlock(encoder, type);
+}
+
+/**
+ * @deprecated Use makeEmptyBlock instead
+ */
+inline Block
+booleanBlock(uint32_t type)
+{
+  return makeEmptyBlock(type);
+}
+
+/**
+ * @deprecated Use makeBinaryBlock instead
+ */
+inline Block
+dataBlock(uint32_t type, const uint8_t* data, size_t dataSize)
+{
+  return makeBinaryBlock(type, data, dataSize);
+}
+
+/**
+ * @deprecated Use makeBinaryBlock instead
+ */
+inline Block
+dataBlock(uint32_t type, const char* data, size_t dataSize)
+{
+  return makeBinaryBlock(type, data, dataSize);
+}
+
+/**
+ * @deprecated Use makeBinaryBlock instead
+ */
+template<class Iterator>
+inline Block
+dataBlock(uint32_t type, Iterator first, Iterator last)
+{
+  return makeBinaryBlock(type, first, last);
+}
+
+/**
+ * @deprecated Use makeNestedBlock instead
+ */
+template<class U>
+inline Block
+nestedBlock(uint32_t type, const U& value)
+{
+  return makeNestedBlock(type, value);
+}
+
+#endif // NDN_CXX_ENABLE_DEPRECATED_BLOCK_HELPERS
+
+} // namespace encoding
+
+using encoding::makeNonNegativeIntegerBlock;
+using encoding::readNonNegativeInteger;
+using encoding::makeEmptyBlock;
+using encoding::makeStringBlock;
+using encoding::readString;
+using encoding::makeBinaryBlock;
+using encoding::makeNestedBlock;
+
+#ifdef NDN_CXX_ENABLE_DEPRECATED_BLOCK_HELPERS
+
+using encoding::nonNegativeIntegerBlock;
+using encoding::booleanBlock;
+using encoding::dataBlock;
+
+#endif // NDN_CXX_ENABLE_DEPRECATED_BLOCK_HELPERS
+
 } // namespace ndn
 
 #endif // NDN_ENCODING_BLOCK_HELPERS_HPP
diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp
index e17fe9a..5e5f666 100644
--- a/src/encoding/block.cpp
+++ b/src/encoding/block.cpp
@@ -206,7 +206,7 @@
   uint64_t length = tlv::readVarNumber(begin, end);
 
   if (length == 0) {
-    return dataBlock(type, static_cast<uint8_t*>(nullptr), length);
+    return makeEmptyBlock(type);
   }
 
   if (length > MAX_SIZE_OF_BLOCK_FROM_STREAM)
@@ -223,7 +223,7 @@
     throw tlv::Error("Not enough data in the buffer to fully parse TLV");
   }
 
-  return dataBlock(type, buf, length);
+  return makeBinaryBlock(type, buf, length);
 }
 
 std::tuple<bool, Block>
diff --git a/src/exclude.cpp b/src/exclude.cpp
index 76a6260..b5482cd 100644
--- a/src/exclude.cpp
+++ b/src/exclude.cpp
@@ -22,7 +22,7 @@
  */
 
 #include "exclude.hpp"
-#include "util/concepts.hpp"
+#include "encoding/block-helpers.hpp"
 
 #include <boost/range/adaptors.hpp>
 
@@ -30,6 +30,7 @@
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Exclude>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Exclude>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Exclude>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Exclude>));
 static_assert(std::is_base_of<tlv::Error, Exclude::Error>::value,
               "Exclude::Error must inherit from tlv::Error");
@@ -45,7 +46,7 @@
 
 template<encoding::Tag TAG>
 size_t
-Exclude::wireEncode(EncodingImpl<TAG>& block) const
+Exclude::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   if (m_exclude.empty()) {
     throw Error("Exclude filter cannot be empty");
@@ -58,23 +59,23 @@
 
   for (const auto& item : m_exclude) {
     if (item.second) {
-      totalLength += prependBooleanBlock(block, tlv::Any);
+      totalLength += prependEmptyBlock(encoder, tlv::Any);
     }
     if (!item.first.empty() || !item.second) {
-      totalLength += item.first.wireEncode(block);
+      totalLength += item.first.wireEncode(encoder);
     }
   }
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(tlv::Exclude);
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::Exclude);
   return totalLength;
 }
 
 template size_t
-Exclude::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
+Exclude::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-Exclude::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
+Exclude::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 const Block&
 Exclude::wireEncode() const
diff --git a/src/exclude.hpp b/src/exclude.hpp
index fe80acc..7f6ff4f 100644
--- a/src/exclude.hpp
+++ b/src/exclude.hpp
@@ -64,7 +64,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /**
    * @brief Encode to a wire format
diff --git a/src/interest.cpp b/src/interest.cpp
index a7ba973..4873f39 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -22,13 +22,13 @@
 #include "interest.hpp"
 #include "util/random.hpp"
 #include "util/crypto.hpp"
-#include "util/concepts.hpp"
 #include "data.hpp"
 
 namespace ndn {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Interest>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Interest>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Interest>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Interest>));
 static_assert(std::is_base_of<tlv::Error, Interest::Error>::value,
               "Interest::Error must inherit from tlv::Error");
@@ -79,9 +79,9 @@
     std::memcpy(const_cast<uint8_t*>(m_nonce.value()), &nonce, sizeof(nonce));
   }
   else {
-    m_nonce = dataBlock(tlv::Nonce,
-                        reinterpret_cast<const uint8_t*>(&nonce),
-                        sizeof(nonce));
+    m_nonce = makeBinaryBlock(tlv::Nonce,
+                              reinterpret_cast<const uint8_t*>(&nonce),
+                              sizeof(nonce));
     m_wire.reset();
   }
   return *this;
@@ -214,7 +214,7 @@
 
 template<encoding::Tag TAG>
 size_t
-Interest::wireEncode(EncodingImpl<TAG>& block) const
+Interest::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
@@ -230,11 +230,11 @@
 
   if (hasLink()) {
     if (hasSelectedDelegation()) {
-      totalLength += prependNonNegativeIntegerBlock(block,
+      totalLength += prependNonNegativeIntegerBlock(encoder,
                                                     tlv::SelectedDelegation,
                                                     m_selectedDelegationIndex);
     }
-    totalLength += prependBlock(block, m_link);
+    totalLength += encoder.prependBlock(m_link);
   }
   else {
     BOOST_ASSERT(!hasSelectedDelegation());
@@ -244,34 +244,34 @@
   if (getInterestLifetime() >= time::milliseconds::zero() &&
       getInterestLifetime() != DEFAULT_INTEREST_LIFETIME)
     {
-      totalLength += prependNonNegativeIntegerBlock(block,
+      totalLength += prependNonNegativeIntegerBlock(encoder,
                                                     tlv::InterestLifetime,
                                                     getInterestLifetime().count());
     }
 
   // Nonce
   getNonce(); // to ensure that Nonce is properly set
-  totalLength += block.prependBlock(m_nonce);
+  totalLength += encoder.prependBlock(m_nonce);
 
   // Selectors
   if (hasSelectors())
     {
-      totalLength += getSelectors().wireEncode(block);
+      totalLength += getSelectors().wireEncode(encoder);
     }
 
   // Name
-  totalLength += getName().wireEncode(block);
+  totalLength += getName().wireEncode(encoder);
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(tlv::Interest);
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::Interest);
   return totalLength;
 }
 
 template size_t
-Interest::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
+Interest::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-Interest::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
+Interest::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 const Block&
 Interest::wireEncode() const
diff --git a/src/interest.hpp b/src/interest.hpp
index 41e3848..80a1b18 100644
--- a/src/interest.hpp
+++ b/src/interest.hpp
@@ -89,7 +89,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /**
    * @brief Encode to a wire format
diff --git a/src/key-locator.cpp b/src/key-locator.cpp
index fd1a7ad..2f92d5d 100644
--- a/src/key-locator.cpp
+++ b/src/key-locator.cpp
@@ -21,12 +21,12 @@
 
 #include "key-locator.hpp"
 #include "encoding/block-helpers.hpp"
-#include "util/concepts.hpp"
 
 namespace ndn {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
 BOOST_CONCEPT_ASSERT((WireEncodable<KeyLocator>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<KeyLocator>));
 BOOST_CONCEPT_ASSERT((WireDecodable<KeyLocator>));
 static_assert(std::is_base_of<tlv::Error, KeyLocator::Error>::value,
               "KeyLocator::Error must inherit from tlv::Error");
@@ -48,7 +48,7 @@
 
 template<encoding::Tag TAG>
 size_t
-KeyLocator::wireEncode(EncodingImpl<TAG>& block) const
+KeyLocator::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   // KeyLocator ::= KEY-LOCATOR-TYPE TLV-LENGTH (Name | KeyDigest)
   // KeyDigest ::= KEY-DIGEST-TYPE TLV-LENGTH BYTE+
@@ -59,22 +59,22 @@
   case KeyLocator_None:
     break;
   case KeyLocator_Name:
-    totalLength += m_name.wireEncode(block);
+    totalLength += m_name.wireEncode(encoder);
     break;
   case KeyLocator_KeyDigest:
-    totalLength += block.prependBlock(m_keyDigest);
+    totalLength += encoder.prependBlock(m_keyDigest);
     break;
   default:
     throw Error("Unsupported KeyLocator type");
   }
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(tlv::KeyLocator);
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::KeyLocator);
   return totalLength;
 }
 
 template size_t
-KeyLocator::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& estimator) const;
+KeyLocator::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
 KeyLocator::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
@@ -180,7 +180,7 @@
   // This function takes a constant reference of a shared pointer.
   // It MUST NOT change the reference count of that shared pointer.
 
-  return this->setKeyDigest(dataBlock(tlv::KeyDigest, keyDigest->get(), keyDigest->size()));
+  return this->setKeyDigest(makeBinaryBlock(tlv::KeyDigest, keyDigest->get(), keyDigest->size()));
 }
 
 bool
diff --git a/src/key-locator.hpp b/src/key-locator.hpp
index 27b8d67..8c206e4 100644
--- a/src/key-locator.hpp
+++ b/src/key-locator.hpp
@@ -72,11 +72,11 @@
 
 public: // encode and decode
   /** \brief prepend wire encoding
-   *  \param block EncodingBuffer or Estimator
+   *  \param encoder EncodingBuffer or Estimator
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /** \return wire encoding
    */
diff --git a/src/link.cpp b/src/link.cpp
index ce05b36..b900450 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -24,7 +24,6 @@
 #include "encoding/block-helpers.hpp"
 #include "util/crypto.hpp"
 #include "security/key-chain.hpp"
-#include "util/concepts.hpp"
 
 #include <algorithm>
 
@@ -34,6 +33,7 @@
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Link>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Link>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Link>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Link>));
 static_assert(std::is_base_of<Data::Error, Link::Error>::value,
               "Link::Error should inherit from Data::Error");
@@ -109,10 +109,10 @@
 }
 
 template size_t
-Link::encodeContent<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&) const;
+Link::encodeContent<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-Link::encodeContent<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&) const;
+Link::encodeContent<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 void
 Link::encodeContent()
diff --git a/src/management/nfd-control-response.cpp b/src/management/nfd-control-response.cpp
index 6de873f..0c2166c 100644
--- a/src/management/nfd-control-response.cpp
+++ b/src/management/nfd-control-response.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2015 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,7 +22,6 @@
 #include "nfd-control-response.hpp"
 #include "encoding/tlv-nfd.hpp"
 #include "encoding/block-helpers.hpp"
-#include "util/concepts.hpp"
 
 namespace ndn {
 namespace nfd {
@@ -56,16 +55,13 @@
     return m_wire;
 
   m_wire = Block(tlv::nfd::ControlResponse);
-  m_wire.push_back
-    (nonNegativeIntegerBlock(tlv::nfd::StatusCode, m_code));
+  m_wire.push_back(makeNonNegativeIntegerBlock(tlv::nfd::StatusCode, m_code));
 
-  m_wire.push_back
-    (dataBlock(tlv::nfd::StatusText, m_text.c_str(), m_text.size()));
+  m_wire.push_back(makeBinaryBlock(tlv::nfd::StatusText, m_text.c_str(), m_text.size()));
 
-  if (m_body.hasWire())
-    {
-      m_wire.push_back(m_body);
-    }
+  if (m_body.hasWire()) {
+    m_wire.push_back(m_body);
+  }
 
   m_wire.encode();
   return m_wire;
diff --git a/src/meta-info.cpp b/src/meta-info.cpp
index 3a70b0d..a1bfa18 100644
--- a/src/meta-info.cpp
+++ b/src/meta-info.cpp
@@ -22,12 +22,12 @@
 #include "meta-info.hpp"
 #include "encoding/block-helpers.hpp"
 #include "encoding/encoding-buffer.hpp"
-#include "util/concepts.hpp"
 
 namespace ndn {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<MetaInfo>));
 BOOST_CONCEPT_ASSERT((WireEncodable<MetaInfo>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<MetaInfo>));
 BOOST_CONCEPT_ASSERT((WireDecodable<MetaInfo>));
 static_assert(std::is_base_of<tlv::Error, MetaInfo::Error>::value,
               "MetaInfo::Error must inherit from tlv::Error");
@@ -165,10 +165,10 @@
 }
 
 template size_t
-MetaInfo::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
+MetaInfo::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-MetaInfo::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
+MetaInfo::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 const Block&
 MetaInfo::wireEncode() const
diff --git a/src/meta-info.hpp b/src/meta-info.hpp
index e88c870..798acd1 100644
--- a/src/meta-info.hpp
+++ b/src/meta-info.hpp
@@ -76,7 +76,7 @@
 
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   const Block&
   wireEncode() const;
diff --git a/src/name-component.cpp b/src/name-component.cpp
index 1cd0d16..576fac4 100644
--- a/src/name-component.cpp
+++ b/src/name-component.cpp
@@ -30,7 +30,6 @@
 #include "util/string-helper.hpp"
 #include "security/cryptopp.hpp"
 #include "util/crypto.hpp"
-#include "util/concepts.hpp"
 
 #include <boost/lexical_cast.hpp>
 
@@ -39,6 +38,7 @@
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Component>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Component>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Component>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Component>));
 static_assert(std::is_base_of<tlv::Error, Component::Error>::value,
               "name::Component::Error must inherit from tlv::Error");
@@ -46,7 +46,7 @@
 static const std::string&
 getSha256DigestUriPrefix()
 {
-  static const std::string prefix { "sha256digest=" };
+  static const std::string prefix{"sha256digest="};
   return prefix;
 }
 
@@ -69,22 +69,22 @@
 }
 
 Component::Component(const Buffer& value)
-  : Block(dataBlock(tlv::NameComponent, value.buf(), value.size()))
+  : Block(makeBinaryBlock(tlv::NameComponent, value.buf(), value.size()))
 {
 }
 
 Component::Component(const uint8_t* value, size_t valueLen)
-  : Block(dataBlock(tlv::NameComponent, value, valueLen))
+  : Block(makeBinaryBlock(tlv::NameComponent, value, valueLen))
 {
 }
 
 Component::Component(const char* str)
-  : Block(dataBlock(tlv::NameComponent, str, std::char_traits<char>::length(str)))
+  : Block(makeBinaryBlock(tlv::NameComponent, str, std::char_traits<char>::length(str)))
 {
 }
 
 Component::Component(const std::string& str)
-  : Block(dataBlock(tlv::NameComponent, str.c_str(), str.size()))
+  : Block(makeStringBlock(tlv::NameComponent, str))
 {
 }
 
@@ -297,7 +297,7 @@
 Component
 Component::fromNumber(uint64_t number)
 {
-  return nonNegativeIntegerBlock(tlv::NameComponent, number);
+  return makeNonNegativeIntegerBlock(tlv::NameComponent, number);
 }
 
 Component
@@ -384,7 +384,7 @@
     throw Error("Cannot create ImplicitSha256DigestComponent (input digest must be " +
                 boost::lexical_cast<std::string>(crypto::SHA256_DIGEST_SIZE) + " octets)");
 
-  return dataBlock(tlv::ImplicitSha256DigestComponent, digest, digestSize);
+  return makeBinaryBlock(tlv::ImplicitSha256DigestComponent, digest, digestSize);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -440,21 +440,21 @@
 
 template<encoding::Tag TAG>
 size_t
-Component::wireEncode(EncodingImpl<TAG>& block) const
+Component::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
   if (value_size() > 0)
-    totalLength += block.prependByteArray(value(), value_size());
-  totalLength += block.prependVarNumber(value_size());
-  totalLength += block.prependVarNumber(type());
+    totalLength += encoder.prependByteArray(value(), value_size());
+  totalLength += encoder.prependVarNumber(value_size());
+  totalLength += encoder.prependVarNumber(type());
   return totalLength;
 }
 
 template size_t
-Component::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
+Component::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-Component::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
+Component::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 const Block&
 Component::wireEncode() const
diff --git a/src/name-component.hpp b/src/name-component.hpp
index c811c9b..6338477 100644
--- a/src/name-component.hpp
+++ b/src/name-component.hpp
@@ -150,7 +150,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /**
    * @brief Encode to a wire format
@@ -619,7 +619,7 @@
 template<class Iterator>
 inline
 Component::Component(Iterator first, Iterator last)
-  : Block(dataBlock(tlv::NameComponent, first, last))
+  : Block(makeBinaryBlock(tlv::NameComponent, first, last))
 {
 }
 
diff --git a/src/name.cpp b/src/name.cpp
index ff698d8..1ba3bfd 100644
--- a/src/name.cpp
+++ b/src/name.cpp
@@ -27,7 +27,6 @@
 
 #include "util/time.hpp"
 #include "util/string-helper.hpp"
-#include "util/concepts.hpp"
 #include "encoding/block.hpp"
 #include "encoding/encoding-buffer.hpp"
 
@@ -37,6 +36,7 @@
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Name>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Name>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Name>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Name>));
 static_assert(std::is_base_of<tlv::Error, Name::Error>::value,
               "Name::Error must inherit from tlv::Error");
@@ -81,7 +81,7 @@
 }
 
 template size_t
-Name::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& estimator) const;
+Name::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
 Name::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
diff --git a/src/name.hpp b/src/name.hpp
index 2cbab7d..d6040e6 100644
--- a/src/name.hpp
+++ b/src/name.hpp
@@ -112,7 +112,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   const Block&
   wireEncode() const;
diff --git a/src/selectors.cpp b/src/selectors.cpp
index ae078e3..6e637fa 100644
--- a/src/selectors.cpp
+++ b/src/selectors.cpp
@@ -22,12 +22,12 @@
 #include "selectors.hpp"
 #include "encoding/encoding-buffer.hpp"
 #include "encoding/block-helpers.hpp"
-#include "util/concepts.hpp"
 
 namespace ndn {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Selectors>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Selectors>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Selectors>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Selectors>));
 static_assert(std::is_base_of<tlv::Error, Selectors::Error>::value,
               "Selectors::Error must inherit from tlv::Error");
@@ -58,7 +58,7 @@
 
 template<encoding::Tag TAG>
 size_t
-Selectors::wireEncode(EncodingImpl<TAG>& block) const
+Selectors::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
@@ -74,43 +74,43 @@
 
   // MustBeFresh
   if (getMustBeFresh()) {
-    totalLength += prependBooleanBlock(block, tlv::MustBeFresh);
+    totalLength += prependEmptyBlock(encoder, tlv::MustBeFresh);
   }
 
   // ChildSelector
   if (getChildSelector() >= 0) {
-    totalLength += prependNonNegativeIntegerBlock(block, tlv::ChildSelector, getChildSelector());
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::ChildSelector, getChildSelector());
   }
 
   // Exclude
   if (!getExclude().empty()) {
-    totalLength += getExclude().wireEncode(block);
+    totalLength += getExclude().wireEncode(encoder);
   }
 
   // PublisherPublicKeyLocator
   if (!getPublisherPublicKeyLocator().empty()) {
-    totalLength += getPublisherPublicKeyLocator().wireEncode(block);
+    totalLength += getPublisherPublicKeyLocator().wireEncode(encoder);
   }
 
   // MaxSuffixComponents
   if (getMaxSuffixComponents() >= 0) {
-    totalLength += prependNonNegativeIntegerBlock(block, tlv::MaxSuffixComponents,
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::MaxSuffixComponents,
                                                   getMaxSuffixComponents());
   }
 
   // MinSuffixComponents
   if (getMinSuffixComponents() >= 0) {
-    totalLength += prependNonNegativeIntegerBlock(block, tlv::MinSuffixComponents,
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::MinSuffixComponents,
                                                   getMinSuffixComponents());
   }
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(tlv::Selectors);
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::Selectors);
   return totalLength;
 }
 
 template size_t
-Selectors::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& estimator) const;
+Selectors::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
 Selectors::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
diff --git a/src/selectors.hpp b/src/selectors.hpp
index 62b4b06..9a1d8a4 100644
--- a/src/selectors.hpp
+++ b/src/selectors.hpp
@@ -60,7 +60,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /**
    * @brief Encode to a wire format
diff --git a/src/signature-info.cpp b/src/signature-info.cpp
index 668e11f..9c1f0de 100644
--- a/src/signature-info.cpp
+++ b/src/signature-info.cpp
@@ -29,6 +29,7 @@
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<SignatureInfo>));
 BOOST_CONCEPT_ASSERT((WireEncodable<SignatureInfo>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<SignatureInfo>));
 BOOST_CONCEPT_ASSERT((WireDecodable<SignatureInfo>));
 static_assert(std::is_base_of<tlv::Error, SignatureInfo::Error>::value,
               "SignatureInfo::Error must inherit from tlv::Error");
@@ -111,30 +112,30 @@
 
 template<encoding::Tag TAG>
 size_t
-SignatureInfo::wireEncode(EncodingImpl<TAG>& block) const
+SignatureInfo::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
   for (std::list<Block>::const_reverse_iterator i = m_otherTlvs.rbegin();
        i != m_otherTlvs.rend(); i++) {
-    totalLength += block.appendBlock(*i);
+    totalLength += encoder.appendBlock(*i);
   }
 
   if (m_hasKeyLocator)
-    totalLength += m_keyLocator.wireEncode(block);
+    totalLength += m_keyLocator.wireEncode(encoder);
 
-  totalLength += prependNonNegativeIntegerBlock(block, tlv::SignatureType, m_type);
+  totalLength += prependNonNegativeIntegerBlock(encoder, tlv::SignatureType, m_type);
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(tlv::SignatureInfo);
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::SignatureInfo);
   return totalLength;
 }
 
 template size_t
-SignatureInfo::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&) const;
+SignatureInfo::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-SignatureInfo::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&) const;
+SignatureInfo::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 
 const Block&
diff --git a/src/signature-info.hpp b/src/signature-info.hpp
index 9e0f063..a88b759 100644
--- a/src/signature-info.hpp
+++ b/src/signature-info.hpp
@@ -105,7 +105,7 @@
   /// @brief Encode to a wire format or estimate wire format
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /// @brief Encode to a wire format
   const Block&
diff --git a/src/util/concepts.hpp b/src/util/concepts.hpp
index b61c301..8d4567e 100644
--- a/src/util/concepts.hpp
+++ b/src/util/concepts.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2015 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,6 +24,7 @@
 
 #include <boost/concept/usage.hpp>
 #include "../encoding/block.hpp"
+#include "../encoding/encoding-buffer.hpp"
 
 namespace ndn {
 
@@ -35,10 +36,31 @@
 public:
   BOOST_CONCEPT_USAGE(WireEncodable)
   {
-    X j;
     Block block = j.wireEncode();
     block.size(); // avoid 'unused variable block'
   }
+
+private:
+  X j;
+};
+
+/** \brief a concept check for TLV abstraction with .wireEncode method
+ */
+template<class X>
+class WireEncodableWithEncodingBuffer
+{
+public:
+  BOOST_CONCEPT_USAGE(WireEncodableWithEncodingBuffer)
+  {
+    EncodingEstimator estimator;
+    size_t estimatedSize = j.wireEncode(estimator);
+
+    EncodingBuffer encoder(estimatedSize, 0);
+    j.wireEncode(encoder);
+  }
+
+private:
+  X j;
 };
 
 /** \brief a concept check for TLV abstraction with .wireDecode method
@@ -65,7 +87,6 @@
   BOOST_CONCEPT_USAGE(Hashable)
   {
     X hash;
-
     uint8_t* buf = 0;
     size_t size = hash.DigestSize();
 
