diff --git a/src/lp/packet.cpp b/src/lp/packet.cpp
index 751faa6..5714547 100644
--- a/src/lp/packet.cpp
+++ b/src/lp/packet.cpp
@@ -37,54 +37,17 @@
   wireDecode(wire);
 }
 
-template<encoding::Tag TAG>
-size_t
-Packet::wireEncode(EncodingImpl<TAG>& encoder) const
-{
-  if (m_wire.hasWire()) {
-    return m_wire.size();
-  }
-
-  size_t length = 0;
-
-  for (const Block& element : boost::adaptors::reverse(m_wire.elements())) {
-    length += encoder.prependBlock(element);
-  }
-
-  length += encoder.prependVarNumber(length);
-  length += encoder.prependVarNumber(tlv::LpPacket);
-
-  return length;
-}
-
-template size_t
-Packet::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
-
-template size_t
-Packet::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
-
 Block
 Packet::wireEncode() const
 {
-  if (m_wire.hasWire()) {
-    return m_wire;
-  }
-
   // If no header or trailer, return bare network packet
   Block::element_container elements = m_wire.elements();
   if (elements.size() == 1 && elements.front().type() == FragmentField::TlvType::value) {
     elements.front().parse();
-    elements.front().elements().front().parse();
     return elements.front().elements().front();
   }
 
-  EncodingEstimator estimator;
-  size_t estimatedSize = wireEncode(estimator);
-
-  EncodingBuffer buffer(estimatedSize, 0);
-  wireEncode(buffer);
-
-  m_wire = buffer.block();
+  m_wire.encode();
   return m_wire;
 }
 
diff --git a/src/lp/packet.hpp b/src/lp/packet.hpp
index e43652d..b2e003e 100644
--- a/src/lp/packet.hpp
+++ b/src/lp/packet.hpp
@@ -46,13 +46,6 @@
   Packet(const Block& wire);
 
   /**
-   * \brief append packet to encoder
-   */
-  template<encoding::Tag TAG>
-  size_t
-  wireEncode(EncodingImpl<TAG>& encoder) const;
-
-  /**
    * \brief encode packet into wire format
    */
   Block
@@ -84,8 +77,6 @@
   size_t
   count() const
   {
-    m_wire.parse();
-
     return std::count_if(m_wire.elements_begin(), m_wire.elements_end(),
                          [] (const Block& block) {
                            return block.type() == FIELD::TlvType::value; });
@@ -99,8 +90,6 @@
   typename FIELD::ValueType
   get(size_t index = 0) const
   {
-    m_wire.parse();
-
     size_t count = 0;
     for (const Block& element : m_wire.elements()) {
       if (element.type() != FIELD::TlvType::value) {
@@ -123,8 +112,6 @@
   {
     std::vector<typename FIELD::ValueType> output;
 
-    m_wire.parse();
-
     for (const Block& element : m_wire.elements()) {
       if (element.type() != FIELD::TlvType::value) {
         continue;
@@ -180,11 +167,8 @@
   Packet&
   remove(size_t index = 0)
   {
-    m_wire.parse();
-
     size_t count = 0;
-    for (Block::element_const_iterator it = m_wire.elements_begin(); it != m_wire.elements_end();
-         ++it) {
+    for (auto it = m_wire.elements_begin(); it != m_wire.elements_end(); ++it) {
       if (it->type() == FIELD::TlvType::value) {
         if (count == index) {
           m_wire.erase(it);
@@ -204,7 +188,6 @@
   Packet&
   clear()
   {
-    m_wire.parse();
     m_wire.remove(FIELD::TlvType::value);
     return *this;
   }
diff --git a/tests/unit-tests/lp/packet.t.cpp b/tests/unit-tests/lp/packet.t.cpp
index 7929487..c173ed2 100644
--- a/tests/unit-tests/lp/packet.t.cpp
+++ b/tests/unit-tests/lp/packet.t.cpp
@@ -125,9 +125,13 @@
   BOOST_CHECK_NO_THROW(packet.add<FragmentField>(std::make_pair(frag.begin(), frag.end())));
   BOOST_CHECK_NO_THROW(packet.add<FragIndexField>(0));
   BOOST_CHECK_NO_THROW(packet.add<AckField>(2));
+  BOOST_REQUIRE_NO_THROW(packet.wireEncode());
   BOOST_CHECK_NO_THROW(packet.add<FragCountField>(1));
+  BOOST_REQUIRE_NO_THROW(packet.wireEncode());
   BOOST_CHECK_NO_THROW(packet.add<AckField>(4));
+  BOOST_REQUIRE_NO_THROW(packet.wireEncode());
   BOOST_CHECK_NO_THROW(packet.add<AckField>(3));
+  BOOST_REQUIRE_NO_THROW(packet.wireEncode());
   Block wire;
   BOOST_REQUIRE_NO_THROW(wire = packet.wireEncode());
   BOOST_CHECK_EQUAL_COLLECTIONS(expectedBlock, expectedBlock + sizeof(expectedBlock),
