diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp
index e6a8b80..9c8ba1e 100644
--- a/src/encoding/block.cpp
+++ b/src/encoding/block.cpp
@@ -183,7 +183,7 @@
 }
 
 void
-Block::parse()
+Block::parse() const
 {
   if (!m_subBlocks.empty() || value_size()==0)
     return;
diff --git a/src/encoding/block.hpp b/src/encoding/block.hpp
index 45cf1ad..32523a5 100644
--- a/src/encoding/block.hpp
+++ b/src/encoding/block.hpp
@@ -120,9 +120,24 @@
   inline void
   reset();
 
-  void
-  parse();
+  /**
+   * @brief Reset wire buffer but keep sub elements (if any)
+   */
+  inline void
+  resetWire();
 
+  /**
+   * @brief Parse wire buffer into subblocks
+   *
+   * This method is not really const, but it does not modify any data.  It simply
+   * parses contents of the buffer into subblocks
+   */
+  void
+  parse() const;
+
+  /**
+   * @brief Encode subblocks into wire buffer
+   */
   void
   encode();
   
@@ -135,12 +150,6 @@
   inline const Block &
   get(uint32_t type) const;
 
-  inline Block &
-  get(uint32_t type);
-  
-  inline element_iterator
-  find(uint32_t type);
-
   inline element_const_iterator
   find(uint32_t type) const;
 
@@ -156,66 +165,48 @@
   inline void
   push_back(const Block &element);
   
-  /**
-   * @brief Get all subelements
-   */
-  inline const element_container&
-  getAll () const;
-
-  inline element_container&
-  getAll ();
-
-  inline const element_container&
-  elements () const;
-
-  inline element_container&
-  elements ();
-  
-  /**
-   * @brief Get all elements of the requested type
-   */
-  element_container
-  getAll(uint32_t type) const;
-
   inline Buffer::const_iterator
   begin() const;
 
   inline Buffer::const_iterator
   end() const;
 
+  inline const uint8_t*
+  wire() const;
+
   inline size_t
   size() const;
 
+  // inline const uint8_t*
+  // buf() const;
+  
   inline Buffer::const_iterator
   value_begin() const;
 
   inline Buffer::const_iterator
   value_end() const;
 
-  inline element_iterator
-  element_begin();
-
-  inline element_iterator
-  element_end();
-
-  inline element_const_iterator
-  element_begin() const;
-
-  inline element_const_iterator
-  element_end() const;
-  
-  inline const uint8_t*
-  wire() const;
-
-  // inline const uint8_t*
-  // buf() const;
-  
   inline const uint8_t*
   value() const;
 
   inline size_t
   value_size() const;
 
+  /**
+   * @brief Get all subelements
+   */
+  inline const element_container&
+  elements () const;
+
+  inline element_const_iterator
+  elements_begin() const;
+
+  inline element_const_iterator
+  elements_end() const;
+
+  inline size_t
+  elements_size() const;
+  
   Block
   blockFromValue() const;
 
@@ -231,7 +222,7 @@
   Buffer::const_iterator m_value_begin;
   Buffer::const_iterator m_value_end;
 
-  element_container m_subBlocks;
+  mutable element_container m_subBlocks;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -267,6 +258,16 @@
   m_begin = m_end = m_value_begin = m_value_end = Buffer::const_iterator(); // not really necessary, but for safety
 }
 
+inline void
+Block::resetWire()
+{
+  m_buffer.reset(); // reset of the shared_ptr
+  // keep subblocks
+
+  // keep type
+  m_begin = m_end = m_value_begin = m_value_end = Buffer::const_iterator(); // not really necessary, but for safety
+}
+
 inline uint32_t
 Block::type() const
 {
@@ -288,22 +289,6 @@
 
   throw Error("(Block::get) Requested a non-existed type [" + boost::lexical_cast<std::string>(type) + "] from Block");
 }
-
-inline Block &
-Block::get(uint32_t type)
-{
-  for (element_iterator i = m_subBlocks.begin ();
-       i != m_subBlocks.end();
-       i++)
-    {
-      if (i->type () == type)
-        {
-          return *i;
-        }
-    }
-
-  throw Error("(Block::get) Requested a non-existed type [" + boost::lexical_cast<std::string>(type) + "] from Block");
-}
   
 inline Block::element_const_iterator
 Block::find(uint32_t type) const
@@ -320,24 +305,11 @@
   return m_subBlocks.end();
 }
 
-inline Block::element_iterator
-Block::find(uint32_t type)
-{
-  for (element_iterator i = m_subBlocks.begin ();
-       i != m_subBlocks.end();
-       i++)
-    {
-      if (i->type () == type)
-        {
-          return i;
-        }
-    }
-  return m_subBlocks.end();
-}
-
 inline void
 Block::remove(uint32_t type)
 {
+  resetWire();
+
   element_container newContainer;
   newContainer.reserve(m_subBlocks.size());
   for (element_iterator i = m_subBlocks.begin();
@@ -348,17 +320,19 @@
         newContainer.push_back(*i);
   }
   m_subBlocks.swap(newContainer);
-  }
+}
 
 inline Block::element_iterator
 Block::erase(Block::element_iterator position)
 {
+  resetWire();
   return m_subBlocks.erase(position);
 }
 
 inline Block::element_iterator
 Block::erase(Block::element_iterator first, Block::element_iterator last)
 {
+  resetWire();
   return m_subBlocks.erase(first, last);
 }
 
@@ -366,34 +340,10 @@
 inline void
 Block::push_back(const Block &element)
 {
+  resetWire();
   m_subBlocks.push_back(element);
 }
 
-
-inline const Block::element_container&
-Block::getAll () const
-{
-  return m_subBlocks;
-}
-
-inline Block::element_container&
-Block::getAll ()
-{
-  return m_subBlocks;
-}
-
-inline const Block::element_container&
-Block::elements () const
-{
-  return m_subBlocks;
-}
-
-inline Block::element_container&
-Block::elements ()
-{
-  return m_subBlocks;
-}
-
 inline Buffer::const_iterator
 Block::begin() const
 {
@@ -440,30 +390,6 @@
   return m_value_end;
 }
 
-inline Block::element_iterator
-Block::element_begin()
-{
-  return m_subBlocks.begin();
-}
-
-inline Block::element_iterator
-Block::element_end()
-{
-  return m_subBlocks.end();
-}
-
-inline Block::element_const_iterator
-Block::element_begin() const
-{
-  return m_subBlocks.begin();
-}
-
-inline Block::element_const_iterator
-Block::element_end() const
-{
-  return m_subBlocks.end();
-}
-
 inline const uint8_t*
 Block::wire() const
 {
@@ -473,15 +399,6 @@
   return &*m_begin;
 }
 
-// inline const uint8_t*
-// Block::buf() const
-// {
-//   if (!hasWire())
-//       throw Error("(Block::wire) Underlying wire buffer is empty");
-
-//   return &*m_begin;
-// }
-
 inline const uint8_t*
 Block::value() const
 {
@@ -500,6 +417,31 @@
   return m_value_end - m_value_begin;
 }
 
+inline const Block::element_container&
+Block::elements () const
+{
+  return m_subBlocks;
+}
+
+inline Block::element_const_iterator
+Block::elements_begin() const
+{
+  return m_subBlocks.begin();
+}
+
+inline Block::element_const_iterator
+Block::elements_end() const
+{
+  return m_subBlocks.end();
+}
+
+inline size_t
+Block::elements_size() const
+{
+  return m_subBlocks.size();
+}
+
+
 } // ndn
 
 #include "block-helpers.hpp"
diff --git a/src/exclude.cpp b/src/exclude.cpp
index 264919b..983daaf 100644
--- a/src/exclude.cpp
+++ b/src/exclude.cpp
@@ -213,14 +213,14 @@
   wire_ = wire;
   wire_.parse();
 
-  Block::element_const_iterator i = wire_.getAll().begin();
+  Block::element_const_iterator i = wire_.elements_begin();
   if (i->type() == Tlv::Any)
     {
       appendExclude(name::Component(), true);
       ++i;
     }
 
-  while (i != wire_.getAll().end())
+  while (i != wire_.elements_end())
     {
       if (i->type() != Tlv::NameComponent)
         throw Error("Incorrect format of Exclude filter");
@@ -228,7 +228,7 @@
       Name::Component excludedComponent (i->value(), i->value_size());
       ++i;
 
-      if (i != wire_.getAll().end())
+      if (i != wire_.elements_end())
         {
           if (i->type() == Tlv::Any)
             {
diff --git a/src/interest.cpp b/src/interest.cpp
index da3cab6..99e5040 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -134,7 +134,7 @@
         (booleanBlock(Tlv::MustBeFresh));
     }
 
-    if (!selectors.getAll().empty())
+    if (!selectors.elements().empty())
       {
         selectors.encode();
         wire_.push_back(selectors);
@@ -180,64 +180,64 @@
   name_.wireDecode(wire_.get(Tlv::Name));
 
   // Selectors
-  Block::element_iterator selectors = wire_.find(Tlv::Selectors);
-  if (selectors != wire_.getAll().end())
+  Block::element_const_iterator selectors = wire_.find(Tlv::Selectors);
+  if (selectors != wire_.elements_end())
     {
       selectors->parse();
 
       // MinSuffixComponents
-      Block::element_iterator val = selectors->find(Tlv::MinSuffixComponents);
-      if (val != selectors->getAll().end())
+      Block::element_const_iterator val = selectors->find(Tlv::MinSuffixComponents);
+      if (val != selectors->elements_end())
         {
           minSuffixComponents_ = readNonNegativeInteger(*val);
         }
 
       // MaxSuffixComponents
       val = selectors->find(Tlv::MaxSuffixComponents);
-      if (val != selectors->getAll().end())
+      if (val != selectors->elements_end())
         {
           maxSuffixComponents_ = readNonNegativeInteger(*val);
         }
 
       // Exclude
       val = selectors->find(Tlv::Exclude);
-      if (val != selectors->getAll().end())
+      if (val != selectors->elements_end())
         {
           exclude_.wireDecode(*val);
         }
 
       // ChildSelector
       val = selectors->find(Tlv::ChildSelector);
-      if (val != selectors->getAll().end())
+      if (val != selectors->elements_end())
         {
           childSelector_ = readNonNegativeInteger(*val);
         }
 
       //MustBeFresh aka AnswerOriginKind
       val = selectors->find(Tlv::MustBeFresh);
-      if (val != selectors->getAll().end())
+      if (val != selectors->elements_end())
         {
           mustBeFresh_ = true;
         }
     }
   
   // Nonce
-  Block::element_iterator val = wire_.find(Tlv::Nonce);
-  if (val != wire_.getAll().end())
+  Block::element_const_iterator val = wire_.find(Tlv::Nonce);
+  if (val != wire_.elements_end())
     {
       nonce_ = readNonNegativeInteger(*val);
     }
 
   // Scope
   val = wire_.find(Tlv::Scope);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       scope_ = readNonNegativeInteger(*val);
     }
   
   // InterestLifetime
   val = wire_.find(Tlv::InterestLifetime);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       interestLifetime_ = readNonNegativeInteger(*val);
     }
diff --git a/src/key-locator.hpp b/src/key-locator.hpp
index a3fb896..54c9725 100644
--- a/src/key-locator.hpp
+++ b/src/key-locator.hpp
@@ -102,10 +102,10 @@
   wire_ = value;
   wire_.parse();
   
-  if (!wire_.getAll().empty() && wire_.getAll().front().type() == Tlv::Name)
+  if (!wire_.elements().empty() && wire_.elements_begin()->type() == Tlv::Name)
     {
       type_ = KeyLocator_Name;
-      name_.wireDecode(wire_.getAll().front());
+      name_.wireDecode(*wire_.elements_begin());
     }
   else
     {
diff --git a/src/management/ndnd-controller.cpp b/src/management/ndnd-controller.cpp
index 302699e..a897e27 100644
--- a/src/management/ndnd-controller.cpp
+++ b/src/management/ndnd-controller.cpp
@@ -175,14 +175,14 @@
   Block content = data.getContent();
   content.parse();
 
-  if (content.getAll().empty())
+  if (content.elements().empty())
     {
       if (static_cast<bool>(onFail))
         onFail("Empty response");
       return;
     }
 
-  Block::element_iterator val = content.getAll().begin();
+  Block::element_const_iterator val = content.elements_begin();
   
   switch(val->type())
     {
@@ -221,14 +221,14 @@
   Block content = data.getContent();
   content.parse();
 
-  if (content.getAll().empty())
+  if (content.elements().empty())
     {
       if (static_cast<bool>(onFail))
         onFail("Empty response");
       return;
     }
 
-  Block::element_iterator val = content.getAll().begin();
+  Block::element_const_iterator val = content.elements_begin();
   
   switch(val->type())
     {
diff --git a/src/management/ndnd-face-instance.hpp b/src/management/ndnd-face-instance.hpp
index 03a8589..0de85ff 100644
--- a/src/management/ndnd-face-instance.hpp
+++ b/src/management/ndnd-face-instance.hpp
@@ -226,57 +226,57 @@
   //                  FreshnessPeriod?
 
   // Action
-  Block::element_iterator val = wire_.find(Tlv::FaceManagement::Action);
-  if (val != wire_.getAll().end())
+  Block::element_const_iterator val = wire_.find(Tlv::FaceManagement::Action);
+  if (val != wire_.elements_end())
     {
       action_ = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
     }
 
   // FaceID
   val = wire_.find(Tlv::FaceManagement::FaceID);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       faceId_ = readNonNegativeInteger(*val);
     }
 
   // IPProto
   val = wire_.find(Tlv::FaceManagement::IPProto);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       ipProto_ = readNonNegativeInteger(*val);
     }
 
   // Host
   val = wire_.find(Tlv::FaceManagement::Host);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       host_ = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
     }
 
   // Port
   val = wire_.find(Tlv::FaceManagement::Port);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       port_ = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
     }
 
   // MulticastInterface
   val = wire_.find(Tlv::FaceManagement::MulticastInterface);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       multicastInterface_ = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
     }
 
   // MulticastTTL
   val = wire_.find(Tlv::FaceManagement::MulticastTTL);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       multicastTtl_ = readNonNegativeInteger(*val);
     }
 
   // FreshnessPeriod
   val = wire_.find(Tlv::FreshnessPeriod);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       freshnessPeriod_ = readNonNegativeInteger(*val);
     }
diff --git a/src/management/ndnd-forwarding-entry.hpp b/src/management/ndnd-forwarding-entry.hpp
index 0a02c7e..5cd81ab 100644
--- a/src/management/ndnd-forwarding-entry.hpp
+++ b/src/management/ndnd-forwarding-entry.hpp
@@ -154,36 +154,36 @@
   //                       FreshnessPeriod?
 
   // Action
-  Block::element_iterator val = wire_.find(Tlv::FaceManagement::Action);
-  if (val != wire_.getAll().end())
+  Block::element_const_iterator val = wire_.find(Tlv::FaceManagement::Action);
+  if (val != wire_.elements_end())
     {
       action_ = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
     }
 
   // Name
   val = wire_.find(Tlv::Name);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       prefix_.wireDecode(*val);
     }
 
   // FaceID
   val = wire_.find(Tlv::FaceManagement::FaceID);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       faceId_ = readNonNegativeInteger(*val);
     }
 
   // ForwardingFlags
   val = wire_.find(Tlv::FaceManagement::ForwardingFlags);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       forwardingFlags_.wireDecode(*val);
     }
 
   // FreshnessPeriod
   val = wire_.find(Tlv::FreshnessPeriod);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       freshnessPeriod_ = readNonNegativeInteger(*val);
     }
diff --git a/src/management/ndnd-status-response.hpp b/src/management/ndnd-status-response.hpp
index 1543bed..74e15fe 100644
--- a/src/management/ndnd-status-response.hpp
+++ b/src/management/ndnd-status-response.hpp
@@ -106,8 +106,8 @@
 
   code_ = readNonNegativeInteger(wire_.get(Tlv::FaceManagement::StatusCode));
 
-  Block::element_iterator val = wire_.find(Tlv::FaceManagement::StatusText);
-  if (val != wire_.getAll().end())
+  Block::element_const_iterator val = wire_.find(Tlv::FaceManagement::StatusText);
+  if (val != wire_.elements_end())
     {
       info_.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
     }
diff --git a/src/management/nfd-control-response.hpp b/src/management/nfd-control-response.hpp
index 238d1c5..1e6ec24 100644
--- a/src/management/nfd-control-response.hpp
+++ b/src/management/nfd-control-response.hpp
@@ -142,8 +142,8 @@
   if (m_wire.type() != tlv::nfd_control::ControlResponse)
     throw Error("Requested decoding of ControlResponse, but Block is of different type");  
   
-  Block::element_iterator val = m_wire.getAll().begin();
-  if (val == m_wire.getAll().end() ||
+  Block::element_const_iterator val = m_wire.elements_begin();
+  if (val == m_wire.elements_end() ||
       val->type() != tlv::nfd_control::StatusCode)
     {
       throw Error("Incorrect ControlResponse format (StatusCode missing or not the first item)");
@@ -152,7 +152,7 @@
   m_code = readNonNegativeInteger(*val);
   ++val;
 
-  if (val == m_wire.getAll().end() ||
+  if (val == m_wire.elements_end() ||
       val->type() != tlv::nfd_control::StatusText)
     {
       throw Error("Incorrect ControlResponse format (StatusText missing or not the second item)");
@@ -160,7 +160,7 @@
   m_text.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
   ++val;
 
-  if (val != m_wire.getAll().end())
+  if (val != m_wire.elements_end())
     m_body = *val;
   else
     m_body = Block();
diff --git a/src/management/nfd-fib-management-options.hpp b/src/management/nfd-fib-management-options.hpp
index 67e344c..ba56d93 100644
--- a/src/management/nfd-fib-management-options.hpp
+++ b/src/management/nfd-fib-management-options.hpp
@@ -162,22 +162,22 @@
   wire_.parse ();
 
   // Name
-  Block::element_iterator val = wire_.find(Tlv::Name);
-  if (val != wire_.getAll().end())
+  Block::element_const_iterator val = wire_.find(Tlv::Name);
+  if (val != wire_.elements_end())
     {
       name_.wireDecode(*val);
     }
 
   // FaceID
   val = wire_.find(tlv::nfd_control::FaceId);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       faceId_ = readNonNegativeInteger(*val);
     }
 
   // Cost
   val = wire_.find(tlv::nfd_control::Cost);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements_end())
     {
       cost_ = readNonNegativeInteger(*val);
     }
diff --git a/src/meta-info.hpp b/src/meta-info.hpp
index 5ad07f6..1c78cc7 100644
--- a/src/meta-info.hpp
+++ b/src/meta-info.hpp
@@ -95,15 +95,15 @@
   //                FreshnessPeriod?
   
   // ContentType
-  Block::element_iterator val = wire_.find(Tlv::ContentType);
-  if (val != wire_.getAll().end())
+  Block::element_const_iterator val = wire_.find(Tlv::ContentType);
+  if (val != wire_.elements().end())
     {
       type_ = readNonNegativeInteger(*val);
     }
 
   // FreshnessPeriod
   val = wire_.find(Tlv::FreshnessPeriod);
-  if (val != wire_.getAll().end())
+  if (val != wire_.elements().end())
     {
       freshnessPeriod_ = readNonNegativeInteger(*val);
     }
diff --git a/src/name.hpp b/src/name.hpp
index 96a2e9d..d58e485 100644
--- a/src/name.hpp
+++ b/src/name.hpp
@@ -125,7 +125,7 @@
   Name& 
   append(const uint8_t *value, size_t valueLength) 
   {
-    m_nameBlock.elements().push_back(Component(value, valueLength));
+    m_nameBlock.push_back(Component(value, valueLength));
     return *this;
   }
 
@@ -136,21 +136,21 @@
   // Name& 
   // append(const Buffer& value) 
   // {
-  //   m_nameBlock.elements().push_back(value);
+  //   m_nameBlock.push_back(value);
   //   return *this;
   // }
   
   Name& 
   append(const ConstBufferPtr &value)
   {
-    m_nameBlock.elements().push_back(value);
+    m_nameBlock.push_back(value);
     return *this;
   }
   
   Name& 
   append(const Component &value)
   {
-    m_nameBlock.elements().push_back(value);
+    m_nameBlock.push_back(value);
     return *this;
   }
 
@@ -164,7 +164,7 @@
   Name& 
   append(const char *value)
   {
-    m_nameBlock.elements().push_back(Component(value));
+    m_nameBlock.push_back(Component(value));
     return *this;
   }
   
@@ -172,9 +172,9 @@
   append(const Block &value)
   {
     if (value.type() == Tlv::NameComponent)
-      m_nameBlock.elements().push_back(value);
+      m_nameBlock.push_back(value);
     else
-      m_nameBlock.elements().push_back(Block(Tlv::NameComponent, value));
+      m_nameBlock.push_back(Block(Tlv::NameComponent, value));
 
     return *this;
   }
@@ -223,7 +223,7 @@
   getPrefix(int nComponents) const
   {
     if (nComponents < 0)
-      return getSubName(0, m_nameBlock.elements().size() + nComponents);
+      return getSubName(0, m_nameBlock.elements_size() + nComponents);
     else
       return getSubName(0, nComponents);
   }
@@ -243,7 +243,7 @@
   Name& 
   appendSegment(uint64_t segment)
   {
-    m_nameBlock.elements().push_back(Component::fromNumberWithMarker(segment, 0x00));
+    m_nameBlock.push_back(Component::fromNumberWithMarker(segment, 0x00));
     return *this;
   }
 
@@ -256,7 +256,7 @@
   Name& 
   appendVersion(uint64_t version)
   {
-    m_nameBlock.elements().push_back(Component::fromNumberWithMarker(version, 0xFD));
+    m_nameBlock.push_back(Component::fromNumberWithMarker(version, 0xFD));
     return *this;
   }
 
@@ -306,7 +306,7 @@
    * @return The number of components.
    */
   size_t 
-  size() const { return m_nameBlock.elements().size(); }
+  size() const { return m_nameBlock.elements_size(); }
 
   /**
    * Get the component at the given index.
@@ -427,48 +427,33 @@
   }
 
   /**
-   * Begin iterator.
-   */
-  iterator
-  begin() { return reinterpret_cast<iterator>(&*m_nameBlock.elements().begin()); }
-
-  /**
    * End iterator (const).
    *
    * @todo Check if this crash when there are no elements in the buffer
    */
   const_iterator
-  end() const { return reinterpret_cast<const_iterator>(&*m_nameBlock.elements().end()); }
+  end() const
+  {
+    return reinterpret_cast<const_iterator>(&*m_nameBlock.elements().end());
+  }
 
   /**
-   * End iterator.
-   */
-  iterator
-  end() { return reinterpret_cast<iterator>(&*m_nameBlock.elements().end()); }
-  
-  /**
    * Reverse begin iterator (const).
    */
   const_reverse_iterator
-  rbegin() const { return const_reverse_iterator(end()); }
-
-  /**
-   * Reverse begin iterator.
-   */
-  reverse_iterator
-  rbegin() { return reverse_iterator(end()); }
+  rbegin() const
+  {
+    return const_reverse_iterator(end());
+  }
 
   /**
    * Reverse end iterator (const).
    */
   const_reverse_iterator
-  rend() const { return const_reverse_iterator(begin()); }
-
-  /**
-   * Reverse end iterator.
-   */
-  reverse_iterator
-  rend() { return reverse_iterator(begin()); }
+  rend() const
+  {
+    return const_reverse_iterator(begin());
+  }
 
 private:
   mutable Block m_nameBlock;
diff --git a/src/security/signature-sha256-with-rsa.hpp b/src/security/signature-sha256-with-rsa.hpp
index b59c765..cfcef90 100644
--- a/src/security/signature-sha256-with-rsa.hpp
+++ b/src/security/signature-sha256-with-rsa.hpp
@@ -33,8 +33,8 @@
       throw Signature::Error("Incorrect signature type");
 
     info_.parse();
-    Block::element_iterator i = info_.find(Tlv::KeyLocator);
-    if (i != info_.getAll().end())
+    Block::element_const_iterator i = info_.find(Tlv::KeyLocator);
+    if (i != info_.elements_end())
       {
         keyLocator_.wireDecode(*i);
       }
diff --git a/src/security/validator.cpp b/src/security/validator.cpp
index 8b1c17f..7979120 100644
--- a/src/security/validator.cpp
+++ b/src/security/validator.cpp
@@ -144,11 +144,8 @@
   try{
     const Block &nameBlock = interestName.wireEncode();
 
-    if(nameBlock.getAll().size() != interestName.size()) //HACK!! we should change it when Name::Component is changed to derive from Block.
-      const_cast<Block&>(nameBlock).parse();
-
-    Signature sig((++nameBlock.getAll().rbegin())->blockFromValue(), 
-                  (nameBlock.getAll().rbegin())->blockFromValue());
+    Signature sig((++nameBlock.elements().rbegin())->blockFromValue(), 
+                  (nameBlock.elements().rbegin())->blockFromValue());
 
     switch(sig.getType()){
     case Signature::Sha256WithRsa:
@@ -156,7 +153,7 @@
         SignatureSha256WithRsa sigSha256Rsa(sig);
 
         return verifySignature(nameBlock.value(), 
-                               nameBlock.value_size() - (nameBlock.getAll().rbegin())->size(), 
+                               nameBlock.value_size() - (nameBlock.elements().rbegin())->size(), 
                                sigSha256Rsa, key);
       }
     default:
