diff --git a/src/interest.cpp b/src/interest.cpp
index 0a4c8d7..0c77d88 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -86,6 +86,13 @@
   if (wire_.hasWire())
     return wire_;
 
+  // Interest ::= INTEREST-TYPE TLV-LENGTH
+  //                Name
+  //                Selectors?
+  //                Nonce
+  //                Scope?
+  //                InterestLifetime?  
+  
   wire_ = Block(Tlv::Interest);
   wire_.push_back(getName().wireEncode());
 
@@ -94,38 +101,24 @@
     Block selectors(Tlv::Selectors);
     
     if (getMinSuffixComponents() >= 0) {
-      OBufferStream os;
-      Tlv::writeVarNumber(os, Tlv::MinSuffixComponents);
-      Tlv::writeVarNumber(os, Tlv::sizeOfNonNegativeInteger(getMinSuffixComponents()));
-      Tlv::writeNonNegativeInteger(os, getMinSuffixComponents());
-
-      selectors.push_back(Block(os.buf()));
+      selectors.push_back
+        (nonNegativeIntegerBlock(Tlv::MinSuffixComponents, getMinSuffixComponents()));
     }
     if (getMaxSuffixComponents() >= 0) {
-      OBufferStream os;
-      Tlv::writeVarNumber(os, Tlv::MaxSuffixComponents);
-      Tlv::writeVarNumber(os, Tlv::sizeOfNonNegativeInteger(getMaxSuffixComponents()));
-      Tlv::writeNonNegativeInteger(os, getMaxSuffixComponents());
-
-      selectors.push_back(Block(os.buf()));
+      selectors.push_back
+        (nonNegativeIntegerBlock(Tlv::MaxSuffixComponents, getMaxSuffixComponents()));
     }
     if (!getExclude().empty()) {
-      selectors.push_back(getExclude().wireEncode());
+      selectors.push_back
+        (getExclude().wireEncode());
     }
     if (getChildSelector() >= 0) {
-      OBufferStream os;
-      Tlv::writeVarNumber(os, Tlv::ChildSelector);
-      Tlv::writeVarNumber(os, Tlv::sizeOfNonNegativeInteger(getChildSelector()));
-      Tlv::writeNonNegativeInteger(os, getChildSelector());
-
-      selectors.push_back(Block(os.buf()));
+      selectors.push_back
+        (nonNegativeIntegerBlock(Tlv::ChildSelector, getChildSelector()));
     }
     if (getMustBeFresh()) {
-      OBufferStream os;
-      Tlv::writeVarNumber(os, Tlv::MustBeFresh);
-      Tlv::writeVarNumber(os, 0);
-
-      selectors.push_back(Block(os.buf()));
+      selectors.push_back
+        (booleanBlock(Tlv::MustBeFresh));
     }
 
     selectors.encode();
@@ -134,29 +127,17 @@
 
   // Nonce
   {
-    OBufferStream os;
-    Tlv::writeVarNumber(os, Tlv::Nonce);
-    Tlv::writeVarNumber(os, Tlv::sizeOfNonNegativeInteger(getNonce()));
-    Tlv::writeNonNegativeInteger(os, getNonce());
-
-    wire_.push_back(Block(os.buf()));
+    wire_.push_back
+      (nonNegativeIntegerBlock(Tlv::Nonce, getNonce()));
   }
   
   if (getScope() >= 0) {
-    OBufferStream os;
-    Tlv::writeVarNumber(os, Tlv::Scope);
-    Tlv::writeVarNumber(os, Tlv::sizeOfNonNegativeInteger(getScope()));
-    Tlv::writeNonNegativeInteger(os, getScope());
-
-    wire_.push_back(Block(os.buf()));
+    wire_.push_back
+      (nonNegativeIntegerBlock(Tlv::Scope, getScope()));
   }
   if (getInterestLifetime() >= 0) {
-    OBufferStream os;
-    Tlv::writeVarNumber(os, Tlv::InterestLifetime);
-    Tlv::writeVarNumber(os, Tlv::sizeOfNonNegativeInteger(getInterestLifetime()));
-    Tlv::writeNonNegativeInteger(os, getInterestLifetime());
-
-    wire_.push_back(Block(os.buf()));
+    wire_.push_back
+      (nonNegativeIntegerBlock(Tlv::InterestLifetime, getInterestLifetime()));
   }
   
   wire_.encode();
@@ -169,6 +150,13 @@
   wire_ = wire;
   wire_.parse();
 
+  // Interest ::= INTEREST-TYPE TLV-LENGTH
+  //                Name
+  //                Selectors?
+  //                Nonce
+  //                Scope?
+  //                InterestLifetime?  
+  
   // Name
   name_.wireDecode(wire_.get(Tlv::Name));
 
@@ -182,16 +170,14 @@
       Block::element_iterator val = selectors->find(Tlv::MinSuffixComponents);
       if (val != selectors->getAll().end())
         {
-          Buffer::const_iterator begin = val->value_begin();
-          minSuffixComponents_ = Tlv::readNonNegativeInteger(val->value_size(), begin, val->value_end());
+          minSuffixComponents_ = readNonNegativeInteger(*val);
         }
 
       // MaxSuffixComponents
       val = selectors->find(Tlv::MaxSuffixComponents);
       if (val != selectors->getAll().end())
         {
-          Buffer::const_iterator begin = val->value_begin();
-          maxSuffixComponents_ = Tlv::readNonNegativeInteger(val->value_size(), begin, val->value_end());
+          maxSuffixComponents_ = readNonNegativeInteger(*val);
         }
 
       // Exclude
@@ -205,8 +191,7 @@
       val = selectors->find(Tlv::ChildSelector);
       if (val != selectors->getAll().end())
         {
-          Buffer::const_iterator begin = val->value_begin();
-          childSelector_ = Tlv::readNonNegativeInteger(val->value_size(), begin, val->value_end());
+          childSelector_ = readNonNegativeInteger(*val);
         }
 
       //MustBeFresh aka AnswerOriginKind
@@ -221,24 +206,21 @@
   Block::element_iterator val = wire_.find(Tlv::Nonce);
   if (val != wire_.getAll().end())
     {
-      Buffer::const_iterator begin = val->value_begin();
-      nonce_ = Tlv::readNonNegativeInteger(val->value_size(), begin, val->value_end());
+      nonce_ = readNonNegativeInteger(*val);
     }
 
   // Scope
   val = wire_.find(Tlv::Scope);
   if (val != wire_.getAll().end())
     {
-      Buffer::const_iterator begin = val->value_begin();
-      scope_ = Tlv::readNonNegativeInteger(val->value_size(), begin, val->value_end());
+      scope_ = readNonNegativeInteger(*val);
     }
   
   // InterestLifetime
   val = wire_.find(Tlv::InterestLifetime);
   if (val != wire_.getAll().end())
     {
-      Buffer::const_iterator begin = val->value_begin();
-      interestLifetime_ = Tlv::readNonNegativeInteger(val->value_size(), begin, val->value_end());
+      interestLifetime_ = readNonNegativeInteger(*val);
     } 
 }
 
