diff --git a/src/management/ndnd-controller.cpp b/src/management/ndnd-controller.cpp
index 1d3fb60..a283826 100644
--- a/src/management/ndnd-controller.cpp
+++ b/src/management/ndnd-controller.cpp
@@ -121,7 +121,7 @@
 {
   // Set the ForwardingEntry as the content of a Data packet and sign.
   Data data;
-  data.setName(Name().appendVersion(ndn::random::generateWord32()));
+  data.setName(Name().appendVersion(random::generateWord32()));
   data.setContent(entry.wireEncode());
 
   // Create an empty signature, since nobody going to verify it for now
@@ -166,7 +166,7 @@
   // Create an interest where the name has the encoded Data packet.
   Name interestName;
   interestName.append("ndnx");
-  interestName.append(m_ndndId.value_begin()+6, m_ndndId.value_end());
+  interestName.append(m_ndndId.value_begin() + 6, m_ndndId.value_end());
   interestName.append(entry.getAction());
   interestName.append(data.wireEncode());
 
diff --git a/src/name-component.cpp b/src/name-component.cpp
index 0fd7bd7..78f32c9 100644
--- a/src/name-component.cpp
+++ b/src/name-component.cpp
@@ -80,69 +80,6 @@
   }  
 }
 
-
-uint64_t
-Component::toNumberWithMarker(uint8_t marker) const
-{
-  if (empty() || *value_begin() != marker)
-    throw Error("Name component does not begin with the expected marker");
-  
-  uint64_t result = 0;
-  for (Buffer::const_iterator i = value_begin()+1; i != value_end(); ++i) {
-    result <<= 8;
-    result |= *i;
-  }
-  
-  return result;
-}
-
-Component 
-Component::fromNumber(uint64_t number)
-{
-  ptr_lib::shared_ptr<Buffer> value(new Buffer);
-  
-  // First encode in little endian.
-  while (number != 0) {
-    value->push_back(number & 0xff);
-    number >>= 8;
-  }
-  
-  // Make it big endian.
-  reverse(value->begin(), value->end());
-  return Component(value);
-}
-
-Component
-Component::fromNumberWithMarker(uint64_t number, uint8_t marker)
-{
-  ptr_lib::shared_ptr<Buffer> value(new Buffer);
-  
-  // Add the leading marker.
-  value->push_back(marker);
-  
-  // First encode in little endian.
-  while (number != 0) {
-    value->push_back(number & 0xff);
-    number >>= 8;
-  }
-  
-  // Make it big endian.
-  reverse(value->begin() + 1, value->end());
-  return Component(value);
-}
-
-uint64_t
-Component::toNumber() const
-{
-  uint64_t result = 0;
-  for (Buffer::const_iterator i = value_begin(); i != value_end(); ++i) {
-    result <<= 8;
-    result |= *i;
-  }
-  
-  return result;
-}
-
 int
 Component::compare(const Component& other) const
 {
diff --git a/src/name-component.hpp b/src/name-component.hpp
index f88c081..238c2be 100644
--- a/src/name-component.hpp
+++ b/src/name-component.hpp
@@ -173,73 +173,37 @@
   }
     
   /**
-   * Interpret this name component as a network-ordered number and return an integer.
+   * @brief Interpret this name component as nonNegativeInteger
+   *
+   * @see http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding
+   *
    * @return The integer number.
    */
   uint64_t
   toNumber() const;
 
   /**
-   * Interpret this name component as a network-ordered number with a marker and return an integer.
-   * @param marker The required first byte of the component.
-   * @return The integer number.
-   * @throw runtime_error If the first byte of the component does not equal the marker.
+   * @brief An alias for toNumber()
    */
   uint64_t
-  toNumberWithMarker(uint8_t marker) const;
-    
+  toVersion() const;
+
   /**
-   * Interpret this name component as a segment number according to NDN name conventions (a network-ordered number 
-   * where the first byte is the marker 0x00).
-   * @return The integer segment number.
-   * @throw runtime_error If the first byte of the component is not the expected marker.
+   * @brief An alias for toNumber()
    */
   uint64_t
-  toSegment() const
-  {
-    return toNumberWithMarker(0x00);
-  }
-    
+  toSegment() const;
+
   /**
-   * @deprecated Use toSegment.
-   */
-  uint64_t
-  toSeqNum() const
-  {
-    return toSegment();
-  }
-        
-  /**
-   * Interpret this name component as a version number according to NDN name conventions (a network-ordered number 
-   * where the first byte is the marker 0xFD).  Note that this returns the exact number from the component
-   * without converting it to a time representation.
-   * @return The integer segment number.
-   * @throw runtime_error If the first byte of the component is not the expected marker.
-   */
-  uint64_t
-  toVersion() const
-  {
-    return toNumberWithMarker(0xFD);
-  }
-    
-  /**
-   * Create a component whose value is the network-ordered encoding of the number.
-   * Note: if the number is zero, the result is empty.
-   * @param number The number to be encoded.
+   * @brief Create a component encoded as nonNegativeInteger
+   *
+   * @see http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding
+   *
+   * @param number The non-negative number
    * @return The component value.
    */
   static Component 
   fromNumber(uint64_t number);
-    
-  /**
-   * Create a component whose value is the marker appended with the network-ordered encoding of the number.
-   * Note: if the number is zero, no bytes are used for the number - the result will have only the marker.
-   * @param number The number to be encoded.  
-   * @param marker The marker to use as the first byte of the component.
-   * @return The component value.
-   */
-  static Component 
-  fromNumberWithMarker(uint64_t number, uint8_t marker);
 
   /**
    * Check if this is the same component as other.
@@ -287,7 +251,7 @@
    * @return 0 If they compare equal, -1 if *this comes before other in the canonical ordering, or
    * 1 if *this comes after other in the canonical ordering.
    *
-   * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
+   * @see http://named-data.net/doc/ndn-tlv/name.html#canonical-order
    */
   int
   compare(const Component& other) const;
@@ -296,7 +260,7 @@
    * Return true if this is less than or equal to the other Component in the NDN canonical ordering.
    * @param other The other Component to compare with.
    *
-   * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
+   * @see http://named-data.net/doc/ndn-tlv/name.html#canonical-order
    */
   bool
   operator <= (const Component& other) const { return compare(other) <= 0; }
@@ -305,7 +269,7 @@
    * Return true if this is less than the other Component in the NDN canonical ordering.
    * @param other The other Component to compare with.
    *
-   * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
+   * @see http://named-data.net/doc/ndn-tlv/name.html#canonical-order
    */
   bool
   operator < (const Component& other) const { return compare(other) < 0; }
@@ -314,7 +278,7 @@
    * Return true if this is less than or equal to the other Component in the NDN canonical ordering.
    * @param other The other Component to compare with.
    *
-   * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
+   * @see http://named-data.net/doc/ndn-tlv/name.html#canonical-order
    */
   bool
   operator >= (const Component& other) const { return compare(other) >= 0; }
@@ -323,7 +287,7 @@
    * Return true if this is greater than the other Component in the NDN canonical ordering.
    * @param other The other Component to compare with.
    *
-   * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
+   * @see http://named-data.net/doc/ndn-tlv/name.html#canonical-order
    */
   bool
   operator > (const Component& other) const { return compare(other) > 0; }
@@ -341,6 +305,35 @@
   return os;
 }
 
+
+inline Component
+Component::fromNumber(uint64_t number)
+{
+  /// \todo Change to Tlv::NumberComponent
+  return nonNegativeIntegerBlock(Tlv::NameComponent, number);
+}
+
+
+inline uint64_t
+Component::toNumber() const
+{
+  /// \todo Check if Component is of Tlv::NumberComponent type
+  return readNonNegativeInteger(static_cast<const Block&>(*this));
+}
+
+
+inline uint64_t
+Component::toVersion() const
+{
+  return toNumber();
+}
+
+inline uint64_t
+Component::toSegment() const
+{
+  return toNumber();
+}
+
 template<bool T>
 inline size_t
 Component::wireEncode(EncodingImpl<T>& block) const
diff --git a/src/name.cpp b/src/name.cpp
index 846cabb..cb8759b 100644
--- a/src/name.cpp
+++ b/src/name.cpp
@@ -88,13 +88,6 @@
   return *this;
 }
 
-Name& 
-Name::appendVersion()
-{
-  appendVersion(time::toUnixTimestamp(time::system_clock::now()).count());
-  return *this;
-}
-
 Name
 Name::getSubName(size_t iStartComponent, size_t nComponents) const
 {
diff --git a/src/name.hpp b/src/name.hpp
index 1d32943..aea084b 100644
--- a/src/name.hpp
+++ b/src/name.hpp
@@ -40,13 +40,13 @@
   typedef const Component*        const_pointer;
   typedef Component*              iterator;
   typedef const Component*        const_iterator;
-  
+
   typedef boost::reverse_iterator<iterator>       reverse_iterator;
   typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
 
   typedef component_container::difference_type difference_type;
   typedef component_container::size_type       size_type;
-  
+
   /**
    * Create a new Name with no components.
    */
@@ -70,7 +70,7 @@
     m_nameBlock = wire;
     m_nameBlock.parse();
   }
-  
+
   /**
    * Parse the uri according to the NDN URI Scheme and create the name with the components.
    * @param uri The URI string.
@@ -79,7 +79,7 @@
   {
     set(uri);
   }
-  
+
   /**
    * Parse the uri according to the NDN URI Scheme and create the name with the components.
    * @param uri The URI string.
@@ -95,7 +95,7 @@
   template<bool T>
   size_t
   wireEncode(EncodingImpl<T> &block) const;
-  
+
   const Block &
   wireEncode() const;
 
@@ -107,30 +107,30 @@
    */
   bool
   hasWire() const;
-    
+
   /**
    * Parse the uri according to the NDN URI Scheme and set the name with the components.
    * @param uri The null-terminated URI string.
    */
-  void 
-  set(const char *uri);  
+  void
+  set(const char *uri);
 
   /**
    * Parse the uri according to the NDN URI Scheme and set the name with the components.
    * @param uri The URI string.
    */
-  void 
+  void
   set(const std::string& uri)
   {
     set(uri.c_str());
-  }  
-  
+  }
+
   /**
    * Append a new component, copying from value of length valueLength.
    * @return This name so that you can chain calls to append.
    */
-  Name& 
-  append(const uint8_t *value, size_t valueLength) 
+  Name&
+  append(const uint8_t *value, size_t valueLength)
   {
     m_nameBlock.push_back(Component(value, valueLength));
     return *this;
@@ -152,21 +152,21 @@
   //  * Append a new component, copying from value.
   //  * @return This name so that you can chain calls to append.
   //  */
-  // Name& 
-  // append(const Buffer& value) 
+  // Name&
+  // append(const Buffer& value)
   // {
   //   m_nameBlock.push_back(value);
   //   return *this;
   // }
-  
-  Name& 
+
+  Name&
   append(const ConstBufferPtr &value)
   {
     m_nameBlock.push_back(value);
     return *this;
   }
-  
-  Name& 
+
+  Name&
   append(const Component &value)
   {
     m_nameBlock.push_back(value);
@@ -180,13 +180,13 @@
    * ``append("string")`` operations (both Component and Name can be implicitly
    * converted from string, each having different outcomes
    */
-  Name& 
+  Name&
   append(const char *value)
   {
     m_nameBlock.push_back(Component(value));
     return *this;
   }
-  
+
   Name&
   append(const Block &value)
   {
@@ -197,7 +197,7 @@
 
     return *this;
   }
-  
+
   /**
    * Append the components of the given name to this name.
    * @param name The Name with components to append.
@@ -205,16 +205,16 @@
    */
   Name&
   append(const Name& name);
-    
+
   /**
    * Clear all the components.
    */
-  void 
+  void
   clear()
   {
     m_nameBlock = Block(Tlv::Name);
   }
-  
+
   /**
    * Get a new name, constructed as a subset of components.
    * @param iStartComponent The index if the first component to get.
@@ -231,7 +231,7 @@
    */
   Name
   getSubName(size_t iStartComponent) const;
-  
+
   /**
    * Return a new Name with the first nComponents components of this Name.
    * @param nComponents The number of prefix components.  If nComponents is -N then return the prefix up
@@ -246,54 +246,19 @@
     else
       return getSubName(0, nComponents);
   }
-  
+
   /**
    * Encode this name as a URI.
    * @return The encoded URI.
    */
-  std::string 
+  std::string
   toUri() const;
-  
-  /**
-   * @deprecated
-   * Append a component with the encoded segment number.
-   * @param segment The segment number.
-   * @return This name so that you can chain calls to append.
-   */  
-  DEPRECATED(Name& 
-  appendSegment(uint64_t segment)
-  {
-    m_nameBlock.push_back(Component::fromNumberWithMarker(segment, 0x00));
-    return *this;
-  })
 
   /**
-   * @deprecated
-   * Append a component with the encoded version number.
-   * Note that this encodes the exact value of version without converting from a time representation.
-   * @param version The version number.
-   * @return This name so that you can chain calls to append.
-   */  
-  DEPRECATED(Name& 
-  appendVersion(uint64_t version)
-  {
-    m_nameBlock.push_back(Component::fromNumberWithMarker(version, 0xFD));
-    return *this;
-  })
-
-  /**
-   * @deprecated
-   * @brief Append a component with the encoded version number.
-   * 
-   * This version of the method creates version number based on the current timestamp
-   * @return This name so that you can chain calls to append.
-   */  
-  DEPRECATED(Name& 
-             appendVersion());
-
-
-  /**
-   * @brief Append a component with the encoded non-negative number.
+   * @brief Append a component with the number encoded as nonNegativeInteger
+   *
+   * @see http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding
+   *
    * @param number The non-negative number
    * @return This name so that you can chain calls to append.
    */
@@ -305,19 +270,44 @@
   }
 
   /**
+   * @brief An alias for appendNumber(uint64_t)
+   */
+  Name&
+  appendVersion(uint64_t number)
+  {
+    return appendNumber(number);
+  }
+
+  /**
+   * @brief Append a component with the encoded version number (current UNIX timestamp
+   *        in milliseconds)
+   */
+  Name&
+  appendVersion();
+
+  /**
+   * @brief An alias for appendNumber(uint64_t)
+   */
+  Name&
+  appendSegment(uint64_t number)
+  {
+    return appendNumber(number);
+  }
+
+  /**
    * Check if this name has the same component count and components as the given name.
    * @param name The Name to check.
    * @return true if the names are equal, otherwise false.
    */
   bool
   equals(const Name& name) const;
-  
+
   /**
    * Check if the N components of this name are the same as the first N components of the given name.
    * @param name The Name to check.
    * @return true if this matches the given name, otherwise false.  This always returns true if this name is empty.
    */
-  bool 
+  bool
   isPrefixOf(const Name& name) const;
 
   bool
@@ -325,7 +315,7 @@
   {
     return isPrefixOf(name);
   }
-  
+
   //
   // vector equivalent interface.
   //
@@ -335,12 +325,12 @@
    */
   bool
   empty() const { return m_nameBlock.elements().empty(); }
-  
+
   /**
    * Get the number of components.
    * @return The number of components.
    */
-  size_t 
+  size_t
   size() const { return m_nameBlock.elements_size(); }
 
   /**
@@ -348,7 +338,7 @@
    * @param i The index of the component, starting from 0.
    * @return The name component at the index.
    */
-  const Component& 
+  const Component&
   get(ssize_t i) const
   {
     if (i >= 0)
@@ -381,18 +371,21 @@
   }
 
   /**
-   * Compare this to the other Name using NDN canonical ordering.  If the first components of each name are not equal, 
-   * this returns -1 if the first comes before the second using the NDN canonical ordering for name components, or 1 if it comes after.
-   * If they are equal, this compares the second components of each name, etc.  If both names are the same up to
-   * the size of the shorter name, this returns -1 if the first name is shorter than the second or 1 if it is longer.  
-   * For example, if you std::sort gives: /a/b/d /a/b/cc /c /c/a /bb .  This is intuitive because all names
-   * with the prefix /a are next to each other.  But it may be also be counter-intuitive because /c comes before /bb 
-   * according to NDN canonical ordering since it is shorter.  
-   * @param other The other Name to compare with.
-   * @return 0 If they compare equal, -1 if *this comes before other in the canonical ordering, or
-   * 1 if *this comes after other in the canonical ordering.
+   * @brief Compare this to the other Name using NDN canonical ordering.
    *
-   * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
+   * If the first components of each name are not equal, this returns -1 if the first comes
+   * before the second using the NDN canonical ordering for name components, or 1 if it
+   * comes after.  If they are equal, this compares the second components of each name, etc.
+   * If both names are the same up to the size of the shorter name, this returns -1 if the
+   * first name is shorter than the second or 1 if it is longer.  For example, if you
+   * std::sort gives: /a/b/d /a/b/cc /c /c/a /bb .  This is intuitive because all names with
+   * the prefix /a are next to each other.  But it may be also be counter-intuitive because
+   * /c comes before /bb according to NDN canonical ordering since it is shorter.  @param
+   * other The other Name to compare with.  @return 0 If they compare equal, -1 if *this
+   * comes before other in the canonical ordering, or 1 if *this comes after other in the
+   * canonical ordering.
+   *
+   * @see http://named-data.net/doc/ndn-tlv/name.html#canonical-order
    */
   int
   compare(const Name& other) const;
@@ -406,7 +399,7 @@
   {
     append(component);
   }
-  
+
   /**
    * Check if this name has the same component count and components as the given name.
    * @param name The Name to check.
@@ -422,12 +415,12 @@
    */
   bool
   operator != (const Name &name) const { return !equals(name); }
-  
+
   /**
    * Return true if this is less than or equal to the other Name in the NDN canonical ordering.
    * @param other The other Name to compare with.
    *
-   * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
+   * @see http://named-data.net/doc/ndn-tlv/name.html#canonical-order
    */
   bool
   operator <= (const Name& other) const { return compare(other) <= 0; }
@@ -436,7 +429,7 @@
    * Return true if this is less than the other Name in the NDN canonical ordering.
    * @param other The other Name to compare with.
    *
-   * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
+   * @see http://named-data.net/doc/ndn-tlv/name.html#canonical-order
    */
   bool
   operator < (const Name& other) const { return compare(other) < 0; }
@@ -445,7 +438,7 @@
    * Return true if this is less than or equal to the other Name in the NDN canonical ordering.
    * @param other The other Name to compare with.
    *
-   * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
+   * @see http://named-data.net/doc/ndn-tlv/name.html#canonical-order
    */
   bool
   operator >= (const Name& other) const { return compare(other) >= 0; }
@@ -454,11 +447,11 @@
    * Return true if this is greater than the other Name in the NDN canonical ordering.
    * @param other The other Name to compare with.
    *
-   * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
+   * @see http://named-data.net/doc/ndn-tlv/name.html#canonical-order
    */
   bool
   operator > (const Name& other) const { return compare(other) > 0; }
-  
+
   //
   // Iterator interface to name components.
   //
@@ -508,7 +501,14 @@
 std::ostream&
 operator<<(std::ostream& os, const Name& name);
 
-inline std::string 
+inline Name&
+Name::appendVersion()
+{
+  appendNumber(time::toUnixTimestamp(time::system_clock::now()).count());
+  return *this;
+}
+
+inline std::string
 Name::toUri() const
 {
   std::ostringstream os;
@@ -531,8 +531,8 @@
 Name::wireEncode(EncodingImpl<T>& blk) const
 {
   size_t total_len = 0;
-  
-  for (const_reverse_iterator i = rbegin (); 
+
+  for (const_reverse_iterator i = rbegin ();
        i != rend ();
        ++i)
     {
@@ -552,13 +552,13 @@
 
   EncodingEstimator estimator;
   size_t estimatedSize = wireEncode(estimator);
-  
+
   EncodingBuffer buffer(estimatedSize, 0);
   wireEncode(buffer);
 
   m_nameBlock = buffer.block();
   m_nameBlock.parse();
-  
+
   return m_nameBlock;
 }
 
@@ -567,7 +567,7 @@
 {
   if (wire.type() != Tlv::Name)
     throw Tlv::Error("Unexpected TLV type when decoding Name");
-  
+
   m_nameBlock = wire;
   m_nameBlock.parse();
 }
@@ -581,4 +581,3 @@
 } // namespace ndn
 
 #endif
-
diff --git a/tools/ndncatchunks3.cpp b/tools/ndncatchunks3.cpp
index cb4750a..7b72614 100644
--- a/tools/ndncatchunks3.cpp
+++ b/tools/ndncatchunks3.cpp
@@ -23,7 +23,9 @@
 class Consumer
 {
 public:
-  Consumer(const std::string& data_name, int pipe_size, int total_seg, int scope = -1, bool mustBeFresh = true)
+  Consumer(const std::string& data_name,
+           size_t pipe_size, size_t total_seg,
+           int scope = -1, bool mustBeFresh = true)
     : m_data_name (data_name)
     , m_pipe_size (pipe_size)
     , m_total_seg (total_seg)
@@ -53,10 +55,10 @@
 
   ndn::Face m_face;
   ndn::Name m_data_name;
-  int m_pipe_size;
-  int m_total_seg;
-  int m_next_seg;
-  int m_total_size;
+  size_t m_pipe_size;
+  size_t m_total_seg;
+  size_t m_next_seg;
+  size_t m_total_size;
   bool m_output;  // set to false by default
 
   int m_scope;
@@ -69,17 +71,17 @@
   try
     {
       for (int i = 0; i < m_pipe_size; i++)
-	{
-	  ndn::Interest interest(ndn::Name(m_data_name).appendSegment (m_next_seg++));
-	  interest.setInterestLifetime(ndn::time::milliseconds(4000));
-	  if (m_scope >= 0)
+        {
+          ndn::Interest interest(ndn::Name(m_data_name).appendSegment(m_next_seg++));
+          interest.setInterestLifetime(ndn::time::milliseconds(4000));
+          if (m_scope >= 0)
             interest.setScope(m_scope);
-	  interest.setMustBeFresh(m_mustBeFresh);
+          interest.setMustBeFresh(m_mustBeFresh);
 
-	  m_face.expressInterest (interest,
-				  ndn::bind(&Consumer::on_data, this, _1, _2),
-				  ndn::bind(&Consumer::on_timeout, this, _1));
-	}
+          m_face.expressInterest (interest,
+                                  ndn::bind(&Consumer::on_data, this, _1, _2),
+                                  ndn::bind(&Consumer::on_timeout, this, _1));
+        }
 
       // processEvents will block until the requested data received or timeout occurs
       m_face.processEvents();
@@ -103,7 +105,7 @@
 
   m_total_size += content.value_size ();
 
-  if ((int)(name.rbegin ()->toSegment ()) + 1 == m_total_seg)
+  if (name[-1].toSegment() + 1 == m_total_seg)
     {
       std::cerr << "Last segment received." << std::endl;
       std::cerr << "Total # bytes of content received: " << m_total_size << std::endl;
@@ -111,15 +113,15 @@
   else
     {
       // Send interest for next segment
-      ndn::Interest interest(ndn::Name(m_data_name).appendSegment (m_next_seg++));
+      ndn::Interest interest(ndn::Name(m_data_name).appendSegment(m_next_seg++));
       if (m_scope >= 0)
         interest.setScope(m_scope);
       interest.setInterestLifetime(ndn::time::milliseconds(4000));
       interest.setMustBeFresh(m_mustBeFresh);
 
       m_face.expressInterest (interest,
-			      ndn::bind(&Consumer::on_data, this, _1, _2),
-			      ndn::bind(&Consumer::on_timeout, this, _1));
+                              ndn::bind(&Consumer::on_data, this, _1, _2),
+                              ndn::bind(&Consumer::on_timeout, this, _1));
     }
 }
 
@@ -152,24 +154,24 @@
   while ((opt = getopt(argc, argv, "op:c:")) != -1)
     {
       switch (opt)
-	{
+        {
         case 'p':
-	  pipe_size = atoi (optarg);
-	  if (pipe_size <= 0)
-	    pipe_size = 1;
-	  std::cerr << "main (): set pipe size = " << pipe_size << std::endl;
-	  break;
-	case 'c':
-	  total_seg = atoi (optarg);
-	  if (total_seg <= 0)
-	    total_seg = 1;
-	  std::cerr << "main (): set total seg = " << total_seg << std::endl;
-	  break;
-	case 'o':
-	  output = true;
-	  break;
+          pipe_size = atoi (optarg);
+          if (pipe_size <= 0)
+            pipe_size = 1;
+          std::cerr << "main (): set pipe size = " << pipe_size << std::endl;
+          break;
+        case 'c':
+          total_seg = atoi (optarg);
+          if (total_seg <= 0)
+            total_seg = 1;
+          std::cerr << "main (): set total seg = " << total_seg << std::endl;
+          break;
+        case 'o':
+          output = true;
+          break;
         default:
-	  return usage(argv[0]);
+          return usage(argv[0]);
         }
     }
 
diff --git a/tools/ndnputchunks3.cpp b/tools/ndnputchunks3.cpp
index d631798..3822ae0 100644
--- a/tools/ndnputchunks3.cpp
+++ b/tools/ndnputchunks3.cpp
@@ -39,7 +39,9 @@
 
         if (got > 0)
           {
-            ndn::shared_ptr<ndn::Data> data = ndn::make_shared<ndn::Data> (ndn::Name(m_name).appendSegment (segnum));
+            ndn::shared_ptr<ndn::Data> data =
+              ndn::make_shared<ndn::Data>(ndn::Name(m_name).appendSegment(segnum));
+
             data->setFreshnessPeriod(ndn::time::milliseconds(10000)); // 10 sec
             data->setContent(reinterpret_cast<const uint8_t*>(buf), got);
 
@@ -48,7 +50,7 @@
             segnum++;
           }
       }
-    while (std::cin);
+    while (static_cast<bool>(std::cin));
 
     if (m_verbose)
       std::cerr << "Created " << segnum << " chunks for prefix [" << m_name << "]" << std::endl;
