diff --git a/model/ccnx-content-store.h b/model/ccnx-content-store.h
index 58e060e..ee29f81 100644
--- a/model/ccnx-content-store.h
+++ b/model/ccnx-content-store.h
@@ -18,60 +18,327 @@
  * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
  */
 
-#ifndef ccnx_content_store_h
-#define	ccnx_content_store_h
+#ifndef CCNX_CONTENT_STORE_H
+#define	CCNX_CONTENT_STORE_H
 
-#include <ns3/system-mutex.h>
+#include "ns3/object.h"
+#include "ns3/ptr.h"
+
 #include <list>
 #include <string>
-#include "hash-helper.h"
+#include <iostream>
 
-using namespace std;
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/tag.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
+#include <boost/multi_index/hashed_index.hpp>
+#include <boost/multi_index/mem_fun.hpp>
+
+#include "hash-helper.h"
+#include "ccnx-content-object-header.h"
+#include "ccnx-interest-header.h"
+#include "name-components.h"
 
 namespace  ns3
 {
-    
-class CsEntry;
-typedef list<CsEntry*>::iterator CsLruIterator;
-        
-//structure for CS entry
-struct CsEntry
-{
-    string contentName;
-    int contentSize;
-            
-    CsLruIterator lruPosition;
-};
-        
-typedef string_key_hash_t<CsEntry>::iterator CsIterator;
-typedef string_key_hash_t<CsEntry>::iterator CsRangeIterator;
-    
-class CcnxContentStore
+class Packet;
+
+/**
+ * \ingroup ccnx
+ * \brief NDN content store entry
+ *
+ * Content store entry stores separately pseudo header and content of
+ * ContentObject packet.  It is responsibility of the caller to
+ * construct a fully formed CcnxPacket by calling Copy(), AddHeader(),
+ * AddTail() on the packet received by GetPacket() method.
+ *
+ * GetFullyFormedCcnxPacket method provided as a convenience
+ */
+class CcnxContentStoreEntry
 {
 public:
-    CcnxContentStore( int max_size=NDN_CONTENT_STORE_SIZE );
-    virtual ~CcnxContentStore( );
+  /**
+   * \brief Construct content store entry
+   *
+   * \param header Parsed CcnxContentObject header
+   * \param packet Original CCNx packet
+   *
+   * The constructor will make a copy of the supplied packet and calls
+   * RemoveHeader and RemoveTail on the copy.
+   */
+  CcnxContentStoreEntry (Ptr<CcnxContentObjectHeader> header, Ptr<const Packet> packet);
+
+  /**
+   * \brief Get prefix of the stored entry
+   * \returns prefix of the stored entry
+   */
+  inline const Name::Components&
+  GetName () const;
+
+  /**
+   * \brief Get CcnxContentObjectHeader of the stored entry
+   * \returns CcnxContentObjectHeader of the stored entry
+   */
+  inline Ptr<const CcnxContentObjectHeader>
+  GetHeader () const;
+
+  /**
+   * \brief Get content of the stored entry
+   * \returns content of the stored entry
+   */
+  inline Ptr<const Packet>
+  GetPacket () const;
+
+  /**
+   * \brief Convenience method to create a fully formed CCNx packet from stored header and content
+   * \returns A read-write copy of the packet with CcnxContentObjectHeader and CcxnContentObjectTail
+   */
+  Ptr<Packet>
+  GetFullyFormedCcnxPacket () const;
+
+// Copy constructor is required by the container. Though, we're
+// storing only two pointers, so shouldn't be a problem
+// private:
+//   CcnxContentStoreEntry (const CcnxContentStoreEntry &); ///< disabled copy constructor
+//   CcnxContentStoreEntry& operator= (const CcnxContentStoreEntry&); ///< disabled copy operator
+  
+private:
+  Ptr<CcnxContentObjectHeader> m_header; ///< \brief non-modifiable CcnxContentObjectHeader
+  Ptr<Packet> m_packet; ///< \brief non-modifiable content of the ContentObject packet
+
+  static CcnxContentObjectTail m_tail; ///< \internal for optimization purposes
+};
+
+/// \brief Private namespace for CCNx implementation
+namespace __ccnx_private
+{
+class hash {}; ///< tag for Boost.Multiindex container (hashed prefix)
+class mru {}; ///< tag for Boost.Multiindex container (most recent used index)
+#ifdef _DEBUG
+class ordered {}; ///< tag for Boost.MultiIndex container (ordered by prefix)
+#endif
+};
+
+/**
+ * \ingroup ccnx
+ * \brief Typedef for content store container implemented as a Boost.MultiIndex container
+ *
+ * - First index (tag<prefix>) is a unique hash index based on NDN prefix of the stored content.
+ * - Second index (tag<mru>) is a sequential index used to maintain up to m_maxSize most recent used (MRU) entries in the content store
+ * - Third index (tag<ordered>) is just a helper to provide stored prefixes in ordered way. Should be disabled in production build
+ *
+ * \see http://www.boost.org/doc/libs/1_46_1/libs/multi_index/doc/ for more information on Boost.MultiIndex library
+ */
+struct CcnxContentStoreContainer
+{
+  typedef
+  boost::multi_index::multi_index_container<
+    CcnxContentStoreEntry,
+    boost::multi_index::indexed_by<
+      boost::multi_index::hashed_unique<
+        boost::multi_index::tag<__ccnx_private::hash>,
+        boost::multi_index::const_mem_fun<CcnxContentStoreEntry,
+                                          const Name::Components&,
+                                          &CcnxContentStoreEntry::GetName>,
+        CcnxPrefixHash>,
+      boost::multi_index::sequenced<boost::multi_index::tag<__ccnx_private::mru> >
+#ifdef _DEBUG
+      ,
+      boost::multi_index::ordered_unique<
+        boost::multi_index::tag<__ccnx_private::ordered>,
+        boost::multi_index::const_mem_fun<CcnxContentStoreEntry,
+                                          const Name::Components&,
+                                          &CcnxContentStoreEntry::GetName>
+          >
+#endif
+      >
+    > type;
+};
+
+/**
+ * \ingroup ccnx
+ * \brief Typedef for hash index of content store container
+ */
+struct CcnxContentStoreByPrefix
+{
+  typedef
+  CcnxContentStoreContainer::type::index<__ccnx_private::hash>::type
+  type;
+};
+
+/**
+ * \ingroup ccnx
+ * \brief Typedef for MRU index of content store container
+ */
+struct CcnxContentStoreByMru
+{
+  typedef
+  CcnxContentStoreContainer::type::index<__ccnx_private::mru>::type
+  type;
+};
+
+#ifdef _DEBUG
+#define DUMP_INDEX_TAG ordered
+#define DUMP_INDEX     CcnxContentStoreOrderedPrefix
+/**
+ * \ingroup ccnx
+ * \brief Typedef for ordered index of content store container
+ */
+struct CcnxContentStoreOrderedPrefix
+{
+  typedef
+  CcnxContentStoreContainer::type::index<__ccnx_private::ordered>::type
+  type;
+};
+#else
+#define DUMP_INDEX_TAG mru
+#define DUMP_INDEX     CcnxContentStoreByMru
+#endif
+  
+/**
+ * \ingroup ccnx
+ * \brief NDN content store entry
+ */
+class CcnxContentStore : public Object
+{
+public:
+  /**
+   * \brief Interface ID
+   *
+   * \return interface ID
+   */
+  static TypeId GetTypeId ();
+  
+  // typedef string_key_hash_t<CsEntry>::iterator CsIterator;
+  // typedef string_key_hash_t<CsEntry>::iterator CsRangeIterator;
+
+  /**
+   * Default constructor
+   */
+  CcnxContentStore( );
+  virtual ~CcnxContentStore( );
             
-    // Find corresponding CS entry for the given content name
-    CsEntry* Lookup( const string prefix );
-    //bool isValid( const CsIterator &it ) { return it!=_cs.end(); }
+  /**
+   * \brief Find corresponding CS entry for the given interest
+   *
+   * \param interest Interest for which matching content store entry
+   * will be searched
+   *
+   * If an entry is found, it is promoted to the top of most recent
+   * used entries index, \see m_contentStore
+   */
+  Ptr<Packet>
+  Lookup (Ptr<const CcnxInterestHeader> interest);
             
-    // Add new content to the content store. Old content will be replaced
-    void Add( const string contentName, int contentSize );
-            
-    // Dump content store entries
-    void Dump( );
+  /**
+   * \brief Add a new content to the content store.
+   *
+   * \param header Fully parsed CcnxContentObjectHeader
+   * \param packet Fully formed CCNx packet to add to content store
+   * (will be copied and stripped down of headers)
+   *
+   * If entry with the same prefix exists, the old entry will be
+   * promoted to the top of the MRU hash
+   */
+  void
+  Add (Ptr<CcnxContentObjectHeader> header, Ptr<const Packet> packet);
+
+  /**
+   * \brief Set maximum size of content store
+   *
+   * \param size size in packets
+   */
+  inline void
+  SetMaxSize (uint32_t maxSize);
+
+  /**
+   * \brief Get maximum size of content store
+   *
+   * \returns size in packets
+   */
+  inline uint32_t
+  GetMaxSize () const;
+  
+  /**
+   * \brief Print out content store entries
+   *
+   * Debug build provides dumping of content store entries in
+   * lexicographical order of corresponding prefixes
+   *
+   * Release build dumps everything in MRU order
+   */
+  void Print () const;
             
 protected:
-    //move the given CS entry to the head of the list
-    void Promote( CsEntry &entry );
-            
+  // /**
+  //  * \brief Move the given CS entry to the head of the list
+  //  *
+  //  * \param entry Content Store entry
+  //  */
+  // void Promote( CsEntry &entry );
+
+  /**
+   * \todo Alex: DoDispose and NotifyNewAggregate are seem to be very
+   * important, but I'm not yet sure what exactly they are supposed to
+   * do
+   */
+  // virtual void DoDispose ();
+  // virtual void NotifyNewAggregate ();
+
 private:
-    int                   m_maxSize; // maximum number of entries in cache
-            
-    string_key_hash_t<CsEntry>  m_contentStore;     // actual content store
-    list<CsEntry*>			  m_LRU;	// LRU index of the content store
-    SystemMutex				m_csMutex;   // just to make sure we are not
+  CcnxContentStore (const CcnxContentStore &o); ///< Disabled copy constructor
+  CcnxContentStore& operator= (const CcnxContentStore &o); ///< Disabled copy operator
+ 
+private:
+  int                         m_maxSize; ///< \brief maximum number of entries in cache \internal
+  // string_key_hash_t<CsEntry>  m_contentStore;     ///< \brief actual content store \internal
+
+  /**
+   * \brief Content store implemented as a Boost.MultiIndex container
+   * \internal
+   */
+    CcnxContentStoreContainer::type m_contentStore;
 };
+
+inline std::ostream&
+operator<< (std::ostream &os, const CcnxContentStore &cs)
+{
+  cs.Print ();
+  return os;
 }
-#endif
+
+const Name::Components&
+CcnxContentStoreEntry::GetName () const
+{
+  return m_header->GetName ();
+}
+
+Ptr<const CcnxContentObjectHeader>
+CcnxContentStoreEntry::GetHeader () const
+{
+  return m_header;
+}
+
+Ptr<const Packet>
+CcnxContentStoreEntry::GetPacket () const
+{
+  return m_packet;
+}
+
+
+inline void
+CcnxContentStore::SetMaxSize (uint32_t maxSize)
+{
+  m_maxSize = maxSize;
+}
+
+inline uint32_t
+CcnxContentStore::GetMaxSize () const
+{
+  return m_maxSize;
+}
+
+} //namespace ns3
+
+#endif // CCNX_CONTENT_STORE_H
