diff --git a/src/stats-table-record.cpp b/src/stats-table-record.cpp
new file mode 100644
index 0000000..65117db
--- /dev/null
+++ b/src/stats-table-record.cpp
@@ -0,0 +1,89 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+* Copyright (c) 2016 Regents of the University of California.
+*
+* This file is part of the nTorrent codebase.
+*
+* nTorrent is free software: you can redistribute it and/or modify it under the
+* terms of the GNU Lesser General Public License as published by the Free Software
+* Foundation, either version 3 of the License, or (at your option) any later version.
+*
+* nTorrent is distributed in the hope that it will be useful, but WITHOUT ANY
+* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+*
+* You should have received copies of the GNU General Public License and GNU Lesser
+* General Public License along with nTorrent, e.g., in COPYING.md file. If not, see
+* <http://www.gnu.org/licenses/>.
+*
+* See AUTHORS for complete list of nTorrent authors and contributors.
+*/
+
+#include "stats-table-record.hpp"
+
+#include <boost/throw_exception.hpp>
+
+namespace ndn {
+namespace ntorrent {
+
+StatsTableRecord::StatsTableRecord(const Name& recordName)
+  : m_recordName(recordName)
+  , m_sentInterests(0)
+  , m_receivedData(0)
+  , m_successRate(0)
+{
+}
+
+StatsTableRecord::StatsTableRecord(const StatsTableRecord& record)
+  : m_recordName(record.getRecordName())
+  , m_sentInterests(record.getRecordSentInterests())
+  , m_receivedData(record.getRecordReceivedData())
+  , m_successRate(record.getRecordSuccessRate())
+{
+}
+
+void
+StatsTableRecord::incrementSentInterests()
+{
+  ++m_sentInterests;
+  m_successRate = m_receivedData / float(m_sentInterests);
+}
+
+void
+StatsTableRecord::incrementReceivedData()
+{
+  if (m_sentInterests == 0) {
+    BOOST_THROW_EXCEPTION(Error("Computing success rate while having sent no Interests"));
+  }
+  ++m_receivedData;
+  m_successRate = m_receivedData / float(m_sentInterests);
+}
+
+StatsTableRecord&
+StatsTableRecord::operator=(const StatsTableRecord& other)
+{
+  m_recordName = other.getRecordName();
+  m_sentInterests = other.getRecordSentInterests();
+  m_receivedData = other.getRecordReceivedData();
+  m_successRate = other.getRecordSuccessRate();
+  return (*this);
+}
+
+bool
+operator==(const StatsTableRecord& lhs, const StatsTableRecord& rhs)
+{
+  return (lhs.getRecordName() == rhs.getRecordName() &&
+  lhs.getRecordSentInterests() == rhs.getRecordSentInterests() &&
+  lhs.getRecordReceivedData() == rhs.getRecordReceivedData());
+}
+
+bool
+operator!=(const StatsTableRecord& lhs, const StatsTableRecord& rhs)
+{
+  return (lhs.getRecordName() != rhs.getRecordName() ||
+  lhs.getRecordSentInterests() != rhs.getRecordSentInterests() ||
+  lhs.getRecordReceivedData() != rhs.getRecordReceivedData());
+}
+
+}  // namespace ntorrent
+}  // namespace ndn
diff --git a/src/stats-table-record.hpp b/src/stats-table-record.hpp
new file mode 100644
index 0000000..59e1ff7
--- /dev/null
+++ b/src/stats-table-record.hpp
@@ -0,0 +1,148 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+* Copyright (c) 2016 Regents of the University of California.
+*
+* This file is part of the nTorrent codebase.
+*
+* nTorrent is free software: you can redistribute it and/or modify it under the
+* terms of the GNU Lesser General Public License as published by the Free Software
+* Foundation, either version 3 of the License, or (at your option) any later version.
+*
+* nTorrent is distributed in the hope that it will be useful, but WITHOUT ANY
+* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+*
+* You should have received copies of the GNU General Public License and GNU Lesser
+* General Public License along with nTorrent, e.g., in COPYING.md file. If not, see
+* <http://www.gnu.org/licenses/>.
+*
+* See AUTHORS for complete list of nTorrent authors and contributors.
+*/
+
+#include <ndn-cxx/name.hpp>
+
+namespace ndn {
+namespace ntorrent {
+
+/**
+ * @brief Represents a record of the stats table
+ */
+class StatsTableRecord {
+public:
+  class Error : public std::runtime_error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : std::runtime_error(what)
+    {
+    }
+  };
+
+  /**
+   * @brief Create a new empty record
+   */
+  StatsTableRecord() = default;
+
+  /**
+   * @brief Create a new record
+   * @param recordName The name of this record
+   */
+  StatsTableRecord(const Name& recordName);
+
+  /**
+   * @brief Copy constructor
+   * @param record An StatsTableRecord object
+   */
+  StatsTableRecord(const StatsTableRecord& record);
+
+  ~StatsTableRecord() = default;
+
+  /**
+   * @brief Get the name of a record
+   */
+  const Name&
+  getRecordName() const;
+
+  /**
+   * @brief Get the number of sent interests of a record
+   */
+  uint64_t
+  getRecordSentInterests() const;
+
+  /**
+   * @brief Get the number of received data packets of a record
+   */
+  uint64_t
+  getRecordReceivedData() const;
+
+  /**
+   * @brief Get the success rate of a record
+   */
+  double
+  getRecordSuccessRate() const;
+
+  /**
+   * @brief Increment the number of sent interests for a record
+   */
+  void
+  incrementSentInterests();
+
+  /**
+   * @brief Increment the number of received data packets for a record
+   */
+  void
+  incrementReceivedData();
+
+  /**
+   * @brief Assignment operator
+   */
+  StatsTableRecord&
+  operator=(const StatsTableRecord& other);
+
+private:
+  Name m_recordName;
+  uint64_t m_sentInterests;
+  uint64_t m_receivedData;
+  double m_successRate;
+};
+
+/**
+ * @brief Equality operator
+ */
+bool
+operator==(const StatsTableRecord& lhs, const StatsTableRecord& rhs);
+
+/**
+ * @brief Inequality operator
+ */
+bool
+operator!=(const StatsTableRecord& lhs, const StatsTableRecord& rhs);
+
+inline const Name&
+StatsTableRecord::getRecordName() const
+{
+  return m_recordName;
+}
+
+inline uint64_t
+StatsTableRecord::getRecordSentInterests() const
+{
+  return m_sentInterests;
+}
+
+inline uint64_t
+StatsTableRecord::getRecordReceivedData() const
+{
+  return m_receivedData;
+}
+
+inline double
+StatsTableRecord::getRecordSuccessRate() const
+{
+  return m_successRate;
+}
+
+
+}  // namespace ntorrent
+}  // namespace ndn
diff --git a/src/stats-table.cpp b/src/stats-table.cpp
new file mode 100644
index 0000000..15076ad
--- /dev/null
+++ b/src/stats-table.cpp
@@ -0,0 +1,73 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+* Copyright (c) 2016 Regents of the University of California.
+*
+* This file is part of the nTorrent codebase.
+*
+* nTorrent is free software: you can redistribute it and/or modify it under the
+* terms of the GNU Lesser General Public License as published by the Free Software
+* Foundation, either version 3 of the License, or (at your option) any later version.
+*
+* nTorrent is distributed in the hope that it will be useful, but WITHOUT ANY
+* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+*
+* You should have received copies of the GNU General Public License and GNU Lesser
+* General Public License along with nTorrent, e.g., in COPYING.md file. If not, see
+* <http://www.gnu.org/licenses/>.
+*
+* See AUTHORS for complete list of nTorrent authors and contributors.
+*/
+
+#include "stats-table.hpp"
+
+namespace ndn {
+namespace ntorrent {
+
+StatsTable::StatsTable(const Name& torrentName)
+  : m_torrentName(torrentName)
+{
+}
+
+void
+StatsTable::insert(const Name& prefix)
+{
+  m_statsTable.push_back(StatsTableRecord(prefix));
+}
+
+StatsTable::const_iterator
+StatsTable::find(const Name& prefix) const
+{
+  for (auto i = m_statsTable.begin(); i != m_statsTable.end(); ++i) {
+    if (i->getRecordName() == prefix) {
+      return i;
+    }
+  }
+  return StatsTable::end();
+}
+
+StatsTable::iterator
+StatsTable::find(const Name& prefix)
+{
+  for (auto i = m_statsTable.begin(); i != m_statsTable.end(); ++i) {
+    if (i->getRecordName() == prefix) {
+      return i;
+    }
+  }
+  return StatsTable::end();
+}
+
+bool
+StatsTable::erase(const Name& prefix)
+{
+  for (auto i = m_statsTable.begin(); i != m_statsTable.end(); ++i) {
+    if (i->getRecordName() == prefix) {
+        m_statsTable.erase(i);
+        return true;
+    }
+  }
+  return false;
+}
+
+}  // namespace ntorrent
+}  // namespace ndn
diff --git a/src/stats-table.hpp b/src/stats-table.hpp
new file mode 100644
index 0000000..0dba20d
--- /dev/null
+++ b/src/stats-table.hpp
@@ -0,0 +1,185 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+* Copyright (c) 2016 Regents of the University of California.
+*
+* This file is part of the nTorrent codebase.
+*
+* nTorrent is free software: you can redistribute it and/or modify it under the
+* terms of the GNU Lesser General Public License as published by the Free Software
+* Foundation, either version 3 of the License, or (at your option) any later version.
+*
+* nTorrent is distributed in the hope that it will be useful, but WITHOUT ANY
+* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+*
+* You should have received copies of the GNU General Public License and GNU Lesser
+* General Public License along with nTorrent, e.g., in COPYING.md file. If not, see
+* <http://www.gnu.org/licenses/>.
+*
+* See AUTHORS for complete list of nTorrent authors and contributors.
+*/
+
+#include "stats-table-record.hpp"
+
+#include <vector>
+
+namespace ndn {
+namespace ntorrent {
+
+/**
+ * @brief Represents a stats table
+ */
+class StatsTable : boost::noncopyable {
+public:
+  /**
+   * @brief Create an empty stats table
+   */
+  StatsTable() = default;
+
+  /**
+   * @brief Create a stats table for a specific torrent
+   * @param torrentName The name of the torrent
+   */
+  StatsTable(const Name& torrentName);
+
+  ~StatsTable() = default;
+
+  /**
+   * @brief Insert a routable prefix to the stats table
+   * @param prefix The prefix to be inserted
+   */
+  void
+  insert(const Name& prefix);
+
+  /**
+   * @brief Erase a prefix from the statsTable
+   * @param prefix The prefix to be erased
+   * @return True if the prefix was found and erased. Otherwise, false
+   */
+  bool
+  erase(const Name& prefix);
+
+  /**
+   * @brief Clear the stats table
+   */
+  void
+  clear();
+
+  /**
+   * @brief Return the size of the stats table (number of prefixes included)
+   */
+  size_t
+  size() const;
+
+  typedef std::vector<StatsTableRecord>::const_iterator const_iterator;
+  typedef std::vector<StatsTableRecord>::iterator iterator;
+
+  /**
+   * @brief Constant iterator to the beginning of the stats table
+   */
+  const_iterator
+  begin() const;
+
+  /**
+   * @brief Iterator to the beginning of the stats table
+   */
+  iterator
+  begin();
+
+  /**
+   * @brief Constant iterator to the end of the stats table
+   */
+  const_iterator
+  end() const;
+
+  /**
+   * @brief Iterator to the end of the stats table
+   */
+  iterator
+  end();
+
+  /**
+   * @brief Find a prefix on the stats table
+   * @param prefix The name prefix to be searched
+   * @return A constant iterator to the prefix if found. Otherwise, return StatsTable::end()
+   */
+  const_iterator
+  find(const Name& prefix) const;
+
+  /**
+   * @brief Find a prefix on the stats table
+   * @param prefix The name prefix to be searched
+   * @return An iterator to the prefix if found. Otherwise, return StatsTable::end()
+   */
+  iterator
+  find(const Name& prefix);
+
+  /**
+   * @brief Comparator used for sorting the records of the stats table
+   */
+  struct comparator {
+    bool operator() (const StatsTableRecord& left, const StatsTableRecord& right) const
+    {return left.getRecordSuccessRate() >= right.getRecordSuccessRate();}
+  };
+
+  /**
+   * @brief Sort the records of the stats table on desceding success rate
+   * @param comp Optional comparator function to be used for sorting.
+   *             The default value is the provided comparator struct
+   *
+   * This method has to be called manually by the application to sort the
+   * stats table.
+   */
+  void
+  sort(std::function<bool(const StatsTableRecord&, const StatsTableRecord&)> comp = comparator());
+
+private:
+  // Set of StatsTableRecords
+  std::vector<StatsTableRecord> m_statsTable;
+  Name m_torrentName;
+};
+
+inline void
+StatsTable::clear()
+{
+  m_statsTable.clear();
+}
+
+inline size_t
+StatsTable::size() const
+{
+  return m_statsTable.size();
+}
+
+inline StatsTable::const_iterator
+StatsTable::begin() const
+{
+  return m_statsTable.begin();
+}
+
+inline StatsTable::iterator
+StatsTable::begin()
+{
+  return m_statsTable.begin();
+}
+
+inline StatsTable::const_iterator
+StatsTable::end() const
+{
+  return m_statsTable.end();
+}
+
+inline StatsTable::iterator
+StatsTable::end()
+{
+  return m_statsTable.end();
+}
+
+inline void
+StatsTable::sort(std::function<bool(const StatsTableRecord&, const StatsTableRecord&)> comp)
+{
+  std::sort(m_statsTable.begin(), m_statsTable.end(), comp);
+}
+
+}  // namespace ntorrent
+}  // namespace ndn
