diff --git a/model/fw/simple-limits.cc b/model/fw/simple-limits.cc
new file mode 100644
index 0000000..eb08444
--- /dev/null
+++ b/model/fw/simple-limits.cc
@@ -0,0 +1,149 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "simple-limits.h"
+
+#include "ns3/ndn-l3-protocol.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+
+#include "ns3/assert.h"
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+#include "ns3/random-variable.h"
+#include "ns3/double.h"
+
+#include <boost/foreach.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+namespace ll = boost::lambda;
+
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.SimpleLimits");
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+NS_OBJECT_ENSURE_REGISTERED (SimpleLimits);
+  
+TypeId
+SimpleLimits::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::ndn::fw::SimpleLimits")
+    .SetGroupName ("Ndn")
+    .SetParent <super> ()
+    .AddConstructor <SimpleLimits> ()
+    ;
+  return tid;
+}
+    
+SimpleLimits::SimpleLimits ()
+{
+}
+
+void
+SimpleLimits::DoDispose ()
+{
+  super::DoDispose ();
+}
+
+void
+SimpleLimits::NotifyNewAggregate ()
+{
+  super::NotifyNewAggregate ();
+}
+
+bool
+SimpleLimits::TrySendOutInterest (Ptr<Face> inFace,
+                                  Ptr<Face> outFace,
+                                  Ptr<const InterestHeader> header,
+                                  Ptr<const Packet> origPacket,
+                                  Ptr<pit::Entry> pitEntry)
+{
+  NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
+  // totally override all (if any) parent processing
+  
+  pit::Entry::out_iterator outgoing =
+    pitEntry->GetOutgoing ().find (outFace);
+
+  if (outgoing != pitEntry->GetOutgoing ().end ())
+    {
+      // just suppress without any other action
+      return false;
+    }
+
+  NS_LOG_DEBUG ("Limit: " << outFace->GetLimits ().m_curMaxLimit << ", outstanding: " << outFace->GetLimits ().m_outstanding);
+  
+  if (outFace->GetLimits ().IsBelowLimit ())
+    {
+      pitEntry->AddOutgoing (outFace);
+
+      //transmission
+      Ptr<Packet> packetToSend = origPacket->Copy ();
+      outFace->Send (packetToSend);
+
+      DidSendOutInterest (outFace, header, origPacket, pitEntry);      
+      return true;
+    }
+  else
+    {
+      NS_LOG_DEBUG ("Face limit for " << header->GetName ());
+    }
+
+  return false;
+}
+
+void
+SimpleLimits::WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry)
+{
+  NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
+
+  for (pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
+       face != pitEntry->GetOutgoing ().end ();
+       face ++)
+    {
+      face->m_face->GetLimits ().RemoveOutstanding ();
+    }
+}
+
+
+void
+SimpleLimits::WillSatisfyPendingInterest (Ptr<Face> inFace,
+                                          Ptr<pit::Entry> pitEntry)
+{
+  NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
+  super::WillSatisfyPendingInterest (inFace, pitEntry);
+
+  for (pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
+       face != pitEntry->GetOutgoing ().end ();
+       face ++)
+    {
+      face->m_face->GetLimits ().RemoveOutstanding ();
+    }
+}
+
+
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
