diff --git a/src/management/nfd-face-event-notification.hpp b/src/management/nfd-face-event-notification.hpp
index 494475e..53640c8 100644
--- a/src/management/nfd-face-event-notification.hpp
+++ b/src/management/nfd-face-event-notification.hpp
@@ -1,48 +1,80 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /**
- * Copyright (C) 2014 Named Data Networking Project
+ * Copyright (C) 2013 Regents of the University of California.
  * See COPYING for copyright and distribution information.
  */
 
 #ifndef NDN_MANAGEMENT_NFD_FACE_EVENT_NOTIFICATION_HPP
 #define NDN_MANAGEMENT_NFD_FACE_EVENT_NOTIFICATION_HPP
 
-#include "../encoding/encoding-buffer.hpp"
+// This include must be kept as the first one, to ensure nfd-face-flags.hpp compiles on its own.
+#include "nfd-face-flags.hpp"
+
 #include "../encoding/tlv-nfd.hpp"
+#include "../encoding/encoding-buffer.hpp"
 
 namespace ndn {
 namespace nfd {
 
-enum FaceEventKind
-  {
-    FACE_EVENT_CREATED = 1,
-    FACE_EVENT_DESTROYED = 2
-  };
+enum FaceEventKind {
+  FACE_EVENT_CREATED = 1,
+  FACE_EVENT_DESTROYED = 2
+};
 
-enum FaceFlags
-  {
-    FACE_IS_LOCAL = 1,
-    FACE_IS_ON_DEMAND = 2
-    // FACE_? = 4
-    // FACE_? = 8
-  };
-
-class FaceEventNotification
+/** \brief represents a Face status change notification
+ *  \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Status-Change-Notification
+ */
+class FaceEventNotification : public FaceFlagsTraits<FaceEventNotification>
 {
 public:
   class Error : public Tlv::Error
   {
   public:
-    Error(const std::string& what) : Tlv::Error(what) { }
+    explicit
+    Error(const std::string& what)
+      : Tlv::Error(what)
+    {
+    }
   };
 
-  FaceEventNotification(FaceEventKind eventKind,
-                        uint64_t faceId,
-                        const std::string& uri,
-                        uint64_t flags);
+  FaceEventNotification();
 
   explicit
-  FaceEventNotification(const Block& block);
+  FaceEventNotification(const Block& block)
+  {
+    this->wireDecode(block);
+  }
+
+  /** \brief prepend FaceEventNotification to the encoder
+   */
+  template<bool T>
+  size_t
+  wireEncode(EncodingImpl<T>& encoder) const;
+
+  /** \brief encode FaceEventNotification
+   */
+  const Block&
+  wireEncode() const;
+
+  /** \brief decode FaceEventNotification
+   */
+  void
+  wireDecode(const Block& wire);
+
+public: // getters & setters
+  FaceEventKind
+  getKind() const
+  {
+    return m_kind;
+  }
+
+  FaceEventNotification&
+  setKind(FaceEventKind kind)
+  {
+    m_wire.reset();
+    m_kind = kind;
+    return *this;
+  }
 
   uint64_t
   getFaceId() const
@@ -50,16 +82,40 @@
     return m_faceId;
   }
 
-  const std::string&
-  getUri() const
+  FaceEventNotification&
+  setFaceId(uint64_t faceId)
   {
-    return m_uri;
+    m_wire.reset();
+    m_faceId = faceId;
+    return *this;
   }
 
-  FaceEventKind
-  getEventKind() const
+  const std::string&
+  getRemoteUri() const
   {
-    return m_kind;
+    return m_remoteUri;
+  }
+
+  FaceEventNotification&
+  setRemoteUri(const std::string& remoteUri)
+  {
+    m_wire.reset();
+    m_remoteUri = remoteUri;
+    return *this;
+  }
+
+  const std::string&
+  getLocalUri() const
+  {
+    return m_localUri;
+  }
+
+  FaceEventNotification&
+  setLocalUri(const std::string& localUri)
+  {
+    m_wire.reset();
+    m_localUri = localUri;
+    return *this;
   }
 
   uint64_t
@@ -68,88 +124,94 @@
     return m_flags;
   }
 
-  bool
-  isLocal() const
+  FaceEventNotification&
+  setFlags(uint64_t flags)
   {
-    return m_flags & FACE_IS_LOCAL;
+    m_wire.reset();
+    m_flags = flags;
+    return *this;
   }
 
-  bool
-  isOnDemand() const
+public: // deprecated
+  /** \deprecated use default constructor and setters
+   */
+  FaceEventNotification(FaceEventKind kind,
+                        uint64_t faceId,
+                        const std::string& uri,
+                        uint64_t flags);
+
+  /** \deprecated
+   */
+  FaceEventKind
+  getEventKind() const
   {
-    return m_flags & FACE_IS_ON_DEMAND;
+    return this->getKind();
   }
 
-  template<bool T>
-  size_t
-  wireEncode(EncodingImpl<T>& buffer) const;
-
-  const Block&
-  wireEncode() const;
-
-  void
-  wireDecode(const Block& wire);
+  /** \deprecated
+   */
+  const std::string&
+  getUri() const
+  {
+    return this->getRemoteUri();
+  }
 
 private:
   FaceEventKind m_kind;
   uint64_t m_faceId;
-  std::string m_uri;
+  std::string m_remoteUri;
+  std::string m_localUri;
   uint64_t m_flags;
 
   mutable Block m_wire;
 };
 
 inline
-FaceEventNotification::FaceEventNotification(FaceEventKind eventKind,
-                                             uint64_t faceId,
-                                             const std::string& uri,
-                                             uint64_t flags)
-  : m_kind(eventKind)
-  , m_faceId(faceId)
-  , m_uri(uri)
-  , m_flags(flags)
+FaceEventNotification::FaceEventNotification()
+  : m_kind(static_cast<FaceEventKind>(0))
+  , m_faceId(0)
+  , m_flags(0)
 {
 }
 
 inline
-FaceEventNotification::FaceEventNotification(const Block& block)
+FaceEventNotification::FaceEventNotification(FaceEventKind kind,
+                                             uint64_t faceId,
+                                             const std::string& uri,
+                                             uint64_t flags)
 {
-  wireDecode(block);
+  (*this).setKind(kind)
+         .setFaceId(faceId)
+         .setRemoteUri(uri)
+         .setFlags(flags);
 }
 
 template<bool T>
-size_t
-FaceEventNotification::wireEncode(EncodingImpl<T>& buffer) const
+inline size_t
+FaceEventNotification::wireEncode(EncodingImpl<T>& encoder) const
 {
   size_t totalLength = 0;
 
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::FaceFlags,
-                                                m_flags);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::FaceFlags, m_flags);
+  totalLength += prependByteArrayBlock(encoder, tlv::nfd::LocalUri,
+                 reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
+  totalLength += prependByteArrayBlock(encoder, tlv::nfd::Uri,
+                 reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::FaceId, m_faceId);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::FaceEventKind, m_kind);
 
-  totalLength += prependByteArrayBlock(buffer,
-                                       tlv::nfd::Uri,
-                                       reinterpret_cast<const uint8_t*>(m_uri.c_str()),
-                                       m_uri.size());
-
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::FaceId,
-                                                m_faceId);
-
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::FaceEventKind,
-                                                static_cast<uint32_t>(m_kind));
-
-  totalLength += buffer.prependVarNumber(totalLength);
-  totalLength += buffer.prependVarNumber(tlv::nfd::FaceEventNotification);
-
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::nfd::FaceEventNotification);
   return totalLength;
 }
 
 inline const Block&
 FaceEventNotification::wireEncode() const
 {
-  if (m_wire.hasWire ())
+  if (m_wire.hasWire())
     return m_wire;
 
   EncodingEstimator estimator;
@@ -163,67 +225,76 @@
 }
 
 inline void
-FaceEventNotification::wireDecode (const Block &wire)
+FaceEventNotification::wireDecode(const Block& block)
 {
-  m_wire = wire;
-
-  if (m_wire.type() != tlv::nfd::FaceEventNotification)
-    throw Error("Requested decoding of FaceEventNotification, but Block is of different type");
-
+  if (block.type() != tlv::nfd::FaceEventNotification) {
+    throw Error("expecting FaceEventNotification block");
+  }
+  m_wire = block;
   m_wire.parse();
-
-  // FaceKind
   Block::element_const_iterator val = m_wire.elements_begin();
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::FaceEventKind)
-    throw Error("Missing required Uri block");
-  m_kind = static_cast<FaceEventKind>(readNonNegativeInteger(*val));
 
-  // FaceID
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::FaceId)
-    throw Error("Missing required FaceId block");
-  m_faceId = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceEventKind) {
+    m_kind = static_cast<FaceEventKind>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required FaceEventKind field");
+  }
 
-  // URI
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::Uri)
-    throw Error("Missing required Uri block");
-  m_uri = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceId) {
+    m_faceId = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required FaceId field");
+  }
 
-  // FaceFlags
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::FaceFlags)
-    throw Error("Missing required FaceFlags block");
-  m_flags = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::Uri) {
+    m_remoteUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
+    ++val;
+  }
+  else {
+    throw Error("missing required Uri field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::LocalUri) {
+    m_localUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
+    ++val;
+  }
+  else {
+    throw Error("missing required LocalUri field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceFlags) {
+    m_flags = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required FaceFlags field");
+  }
 }
 
 inline std::ostream&
-operator << (std::ostream& os, const FaceEventNotification& event)
+operator<<(std::ostream& os, const FaceEventNotification& notification)
 {
   os << "FaceEventNotification(";
 
-  os << "Kind: ";
-  switch (event.getEventKind())
+  switch (notification.getKind())
     {
     case FACE_EVENT_CREATED:
-      os << "created";
+      os << "Kind: created, ";
       break;
     case FACE_EVENT_DESTROYED:
-      os << "destroyed";
+      os << "Kind: destroyed, ";
       break;
     }
-  os << ", ";
 
-  // FaceID
-  os << "FaceID: " << event.getFaceId() << ", ";
-
-  // URI
-  os << "Uri: " << event.getUri() << ", ";
-
-  // Flags
-  os << "Flags: " << event.getFlags();
-
-  os << ")";
+  os << "FaceID: " << notification.getFaceId() << ", "
+     << "RemoteUri: " << notification.getRemoteUri() << ", "
+     << "LocalUri: " << notification.getLocalUri() << ", "
+     << "Flags: " << notification.getFlags()
+     << ")";
   return os;
 }
 
diff --git a/src/management/nfd-face-flags.hpp b/src/management/nfd-face-flags.hpp
new file mode 100644
index 0000000..49baac7
--- /dev/null
+++ b/src/management/nfd-face-flags.hpp
@@ -0,0 +1,53 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP
+#define NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP
+
+namespace ndn {
+namespace nfd {
+
+/** \class FaceFlags
+ *  \brief provides additional information about a face
+ */
+enum {
+  /** \brief face is local (for scope control purpose)
+   */
+  FACE_IS_LOCAL = 1,
+  /** \brief face is created on demand (accepted incoming connection,
+   *         not initiated outgoing connection)
+   */
+  FACE_IS_ON_DEMAND = 2
+  // FACE_? = 4
+  // FACE_? = 8
+};
+
+/** \brief implements getters to each face flag
+ *
+ *  \tparam T class containing a FaceFlags field and implements
+ *            `FaceFlags getFlags() const` method
+ */
+template<typename T>
+class FaceFlagsTraits
+{
+public:
+  bool
+  isLocal() const
+  {
+    return static_cast<const T*>(this)->getFlags() & FACE_IS_LOCAL;
+  }
+
+  bool
+  isOnDemand() const
+  {
+    return static_cast<const T*>(this)->getFlags() & FACE_IS_ON_DEMAND;
+  }
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP
diff --git a/src/management/nfd-face-status.hpp b/src/management/nfd-face-status.hpp
index f3abdb5..1c2e636 100644
--- a/src/management/nfd-face-status.hpp
+++ b/src/management/nfd-face-status.hpp
@@ -1,151 +1,290 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /**
- * Copyright (C) 2014 Named Data Networking Project
+ * Copyright (C) 2013 Regents of the University of California.
  * See COPYING for copyright and distribution information.
  */
 
 #ifndef NDN_MANAGEMENT_NFD_FACE_STATUS_HPP
 #define NDN_MANAGEMENT_NFD_FACE_STATUS_HPP
 
-#include "../encoding/encoding-buffer.hpp"
+// This include must be kept as the first one, to ensure nfd-face-flags.hpp compiles on its own.
+#include "nfd-face-flags.hpp"
+
 #include "../encoding/tlv-nfd.hpp"
+#include "../encoding/encoding-buffer.hpp"
 
 namespace ndn {
 namespace nfd {
 
-class FaceStatus
+/** \brief represents Face status
+ *  \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Dataset
+ */
+class FaceStatus : public FaceFlagsTraits<FaceStatus>
 {
 public:
   class Error : public Tlv::Error
   {
   public:
-    Error(const std::string& what) : Tlv::Error(what) { }
+    explicit
+    Error(const std::string& what)
+      : Tlv::Error(what)
+    {
+    }
   };
 
-  FaceStatus(const uint64_t faceId,
-             const std::string& uri,
-             uint64_t inInterest, uint64_t inData, uint64_t outInterest, uint64_t outData);
+  FaceStatus();
 
   explicit
-  FaceStatus(const Block& block);
+  FaceStatus(const Block& block)
+  {
+    this->wireDecode(block);
+  }
 
+  /** \brief prepend FaceStatus to the encoder
+   */
+  template<bool T>
+  size_t
+  wireEncode(EncodingImpl<T>& encoder) const;
+
+  /** \brief encode FaceStatus
+   */
+  const Block&
+  wireEncode() const;
+
+  /** \brief decode FaceStatus
+   */
+  void
+  wireDecode(const Block& wire);
+
+public: // getters & setters
   uint64_t
   getFaceId() const
   {
     return m_faceId;
   }
 
+  FaceStatus&
+  setFaceId(uint64_t faceId)
+  {
+    m_wire.reset();
+    m_faceId = faceId;
+    return *this;
+  }
+
+  const std::string&
+  getRemoteUri() const
+  {
+    return m_remoteUri;
+  }
+
+  FaceStatus&
+  setRemoteUri(const std::string& remoteUri)
+  {
+    m_wire.reset();
+    m_remoteUri = remoteUri;
+    return *this;
+  }
+
+  const std::string&
+  getLocalUri() const
+  {
+    return m_localUri;
+  }
+
+  FaceStatus&
+  setLocalUri(const std::string& localUri)
+  {
+    m_wire.reset();
+    m_localUri = localUri;
+    return *this;
+  }
+
+  uint64_t
+  getFlags() const
+  {
+    return m_flags;
+  }
+
+  FaceStatus&
+  setFlags(uint64_t flags)
+  {
+    m_wire.reset();
+    m_flags = flags;
+    return *this;
+  }
+
+  uint64_t
+  getNInInterests() const
+  {
+    return m_nInInterests;
+  }
+
+  FaceStatus&
+  setNInInterests(uint64_t nInInterests)
+  {
+    m_wire.reset();
+    m_nInInterests = nInInterests;
+    return *this;
+  }
+
+  uint64_t
+  getNInDatas() const
+  {
+    return m_nInDatas;
+  }
+
+  FaceStatus&
+  setNInDatas(uint64_t nInDatas)
+  {
+    m_wire.reset();
+    m_nInDatas = nInDatas;
+    return *this;
+  }
+
+  uint64_t
+  getNOutInterests() const
+  {
+    return m_nOutInterests;
+  }
+
+  FaceStatus&
+  setNOutInterests(uint64_t nOutInterests)
+  {
+    m_wire.reset();
+    m_nOutInterests = nOutInterests;
+    return *this;
+  }
+
+  uint64_t
+  getNOutDatas() const
+  {
+    return m_nOutDatas;
+  }
+
+  FaceStatus&
+  setNOutDatas(uint64_t nOutDatas)
+  {
+    m_wire.reset();
+    m_nOutDatas = nOutDatas;
+    return *this;
+  }
+
+public: // deprecated
+  /** \deprecated
+   */
+  FaceStatus(const uint64_t faceId,
+             const std::string& uri,
+             uint64_t inInterest, uint64_t inData, uint64_t outInterest, uint64_t outData);
+
+  /** \deprecated
+   */
   const std::string&
   getUri() const
   {
-    return m_uri;
+    return this->getRemoteUri();
   }
 
+  /** \deprecated
+   */
   const uint64_t
   getInInterest() const
   {
-    return m_inInterest;
+    return this->getNInInterests();
   }
 
+  /** \deprecated
+   */
   const uint64_t
   getInData() const
   {
-    return m_inData;
+    return this->getNInDatas();
   }
 
+  /** \deprecated
+   */
   const uint64_t
   getOutInterest() const
   {
-    return m_outInterest;
+    return this->getNOutInterests();
   }
 
+  /** \deprecated
+   */
   const uint64_t
   getOutData() const
   {
-    return m_outData;
+    return this->getNOutDatas();
   }
 
-  template<bool T>
-  size_t
-  wireEncode(EncodingImpl<T>& buffer) const;
-
-  const Block&
-  wireEncode() const;
-
-  void
-  wireDecode(const Block& wire);
-
 private:
   uint64_t m_faceId;
-  std::string m_uri;
-  uint64_t m_inInterest;
-  uint64_t m_inData;
-  uint64_t m_outInterest;
-  uint64_t m_outData;
+  std::string m_remoteUri;
+  std::string m_localUri;
+  uint64_t m_flags;
+  uint64_t m_nInInterests;
+  uint64_t m_nInDatas;
+  uint64_t m_nOutInterests;
+  uint64_t m_nOutDatas;
 
   mutable Block m_wire;
 };
 
 inline
-FaceStatus::FaceStatus(const uint64_t faceId,
-             const std::string& uri,
-             uint64_t inInterest, uint64_t inData, uint64_t outInterest, uint64_t outData)
-  : m_faceId(faceId)
-  , m_uri(uri)
-  , m_inInterest(inInterest)
-  , m_inData(inData)
-  , m_outInterest(outInterest)
-  , m_outData(outData)
+FaceStatus::FaceStatus()
+  : m_faceId(0)
+  , m_flags(0)
+  , m_nInInterests(0)
+  , m_nInDatas(0)
+  , m_nOutInterests(0)
+  , m_nOutDatas(0)
 {
 }
 
 inline
-FaceStatus::FaceStatus(const Block& block)
+FaceStatus::FaceStatus(const uint64_t faceId,
+             const std::string& uri,
+             uint64_t inInterest, uint64_t inData, uint64_t outInterest, uint64_t outData)
 {
-  wireDecode(block);
+  (*this).setFaceId(faceId)
+         .setRemoteUri(uri)
+         .setNInInterests(inInterest)
+         .setNInDatas(inData)
+         .setNOutInterests(outInterest)
+         .setNOutDatas(outData);
 }
 
 template<bool T>
-size_t
-FaceStatus::wireEncode(EncodingImpl<T>& buffer) const
+inline size_t
+FaceStatus::wireEncode(EncodingImpl<T>& encoder) const
 {
   size_t totalLength = 0;
 
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::TotalOutgoingDataCounter,
-                                                m_outData);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::NOutDatas, m_nOutDatas);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::NOutInterests, m_nOutInterests);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::NInDatas, m_nInDatas);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::NInInterests, m_nInInterests);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::FaceFlags, m_flags);
+  totalLength += prependByteArrayBlock(encoder, tlv::nfd::LocalUri,
+                 reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
+  totalLength += prependByteArrayBlock(encoder, tlv::nfd::Uri,
+                 reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::FaceId, m_faceId);
 
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::TotalOutgoingInterestCounter,
-                                                m_outInterest);
-
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::TotalIncomingDataCounter,
-                                                m_inData);
-
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::TotalIncomingInterestCounter,
-                                                m_inInterest);
-
-  totalLength += prependByteArrayBlock(buffer,
-                                       tlv::nfd::Uri,
-                                       reinterpret_cast<const uint8_t*>(m_uri.c_str()),
-                                       m_uri.size());
-
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::FaceId,
-                                                m_faceId);
-
-  totalLength += buffer.prependVarNumber(totalLength);
-  totalLength += buffer.prependVarNumber(tlv::nfd::FaceStatus);
-
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::nfd::FaceStatus);
   return totalLength;
 }
 
-const Block&
+inline const Block&
 FaceStatus::wireEncode() const
 {
-  if (m_wire.hasWire ())
+  if (m_wire.hasWire())
     return m_wire;
 
   EncodingEstimator estimator;
@@ -159,71 +298,95 @@
 }
 
 inline void
-FaceStatus::wireDecode(const Block &wire)
+FaceStatus::wireDecode(const Block& block)
 {
-  m_wire = wire;
-
-  if (m_wire.type() != tlv::nfd::FaceStatus)
-    throw Error("Requested decoding of FaceStatus, but Block is of different type");
-
+  if (block.type() != tlv::nfd::FaceStatus) {
+    throw Error("expecting FaceStatus block");
+  }
+  m_wire = block;
   m_wire.parse();
-
-  // FaceKind
   Block::element_const_iterator val = m_wire.elements_begin();
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::FaceId)
-    throw Error("Missing required FaceId block");
-  m_faceId = readNonNegativeInteger(*val);
 
-  // URI
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::Uri)
-    throw Error("Missing required Uri block");
-  m_uri = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceId) {
+    m_faceId = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required FaceId field");
+  }
 
-  // TotalIncomingInterestCounter
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::TotalIncomingInterestCounter)
-    throw Error("Missing required FaceId block");
-  m_inInterest = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::Uri) {
+    m_remoteUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
+    ++val;
+  }
+  else {
+    throw Error("missing required Uri field");
+  }
 
-  // TotalIncomingDataCounter
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::TotalIncomingDataCounter)
-    throw Error("Missing required FaceId block");
-  m_inData = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::LocalUri) {
+    m_localUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
+    ++val;
+  }
+  else {
+    throw Error("missing required LocalUri field");
+  }
 
-  // TotalOutgoingInterestCounter
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::TotalOutgoingInterestCounter)
-    throw Error("Missing required FaceId block");
-  m_outInterest = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceFlags) {
+    m_flags = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required FaceFlags field");
+  }
 
-  // TotalOutgoingDataCounter
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::TotalOutgoingDataCounter)
-    throw Error("Missing required FaceId block");
-  m_outData = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInInterests) {
+    m_nInInterests = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required NInInterests field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInDatas) {
+    m_nInDatas = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required NInDatas field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutInterests) {
+    m_nOutInterests = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required NOutInterests field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutDatas) {
+    m_nOutDatas = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required NOutDatas field");
+  }
 }
 
 inline std::ostream&
-operator << (std::ostream& os, const FaceStatus& status)
+operator<<(std::ostream& os, const FaceStatus& status)
 {
-  os << "FaceStatus(";
-
-  // FaceID
-  os << "FaceID: " << status.getFaceId() << ", ";
-
-  // URI
-  os << "Uri: " << status.getUri() << ", ";
-
-  os << "Counters: " << status.getInInterest() << "|" << status.getInData()
-     << "|" << status.getOutInterest() << "|" << status.getOutData();
-
-  os << ")";
+  os << "FaceStatus("
+     << "FaceID: " << status.getFaceId() << ", "
+     << "RemoteUri: " << status.getRemoteUri() << ", "
+     << "LocalUri: " << status.getLocalUri() << ", "
+     << "Flags: " << status.getFlags() << ", "
+     << "Counters: " << status.getNInInterests() << "|" << status.getNInDatas()
+     << "|" << status.getNOutInterests() << "|" << status.getNOutDatas()
+     << ")";
   return os;
 }
 
 } // namespace nfd
 } // namespace ndn
 
-#endif // NDN_MANAGEMENT_NFD_FACE_EVENT_STATUS_HPP
+#endif // NDN_MANAGEMENT_NFD_FACE_STATUS_HPP
diff --git a/src/management/nfd-forwarder-status.hpp b/src/management/nfd-forwarder-status.hpp
index de8a93b..af1e05a 100644
--- a/src/management/nfd-forwarder-status.hpp
+++ b/src/management/nfd-forwarder-status.hpp
@@ -8,7 +8,6 @@
 #define NDN_MANAGEMENT_NFD_FORWARDER_STATUS_HPP
 
 #include "../encoding/tlv-nfd.hpp"
-#include "../encoding/tlv.hpp"
 #include "../encoding/encoding-buffer.hpp"
 
 namespace ndn {
@@ -260,8 +259,8 @@
   , m_nInDatas(0)
   , m_nOutInterests(0)
   , m_nOutDatas(0)
-  {
-  }
+{
+}
 
 template<bool T>
 inline size_t
@@ -318,21 +317,8 @@
 inline void
 ForwarderStatus::wireDecode(const Block& block)
 {
-  m_nfdVersion = 0;
-  m_startTimestamp = time::system_clock::TimePoint::min();
-  m_currentTimestamp = time::system_clock::TimePoint::min();
-  m_nNameTreeEntries = 0;
-  m_nFibEntries = 0;
-  m_nPitEntries = 0;
-  m_nMeasurementsEntries = 0;
-  m_nCsEntries = 0;
-  m_nInInterests = 0;
-  m_nInDatas = 0;
-  m_nOutInterests = 0;
-  m_nOutDatas = 0;
-
   if (block.type() != Tlv::Content) {
-    throw Error("Requested decoding of Status Payload, but block is not Content");
+    throw Error("expecting Content block for Status payload");
   }
   m_wire = block;
   m_wire.parse();
