diff --git a/src/main/java/net/floodlightcontroller/core/IListener.java b/src/main/java/net/floodlightcontroller/core/IListener.java
index 30f3f086e4210ad669f2d44549a378b4aae63ac6..1bd656022d257cac1508eb80e064b79e03fbfdbc 100644
--- a/src/main/java/net/floodlightcontroller/core/IListener.java
+++ b/src/main/java/net/floodlightcontroller/core/IListener.java
@@ -17,14 +17,11 @@
 
 package net.floodlightcontroller.core;
 
-/**
- * Interface for implementing an event listener with support for ordering 
- * based on prerequisites and postrequisites.
- * @author readams
- *
- * @param <T> The event type
- */
 public interface IListener<T> {
+    public enum Command {
+        CONTINUE, STOP
+    }
+    
     /**
      * The name assigned to this listener
      * @return
diff --git a/src/main/java/net/floodlightcontroller/core/IOFMessageListener.java b/src/main/java/net/floodlightcontroller/core/IOFMessageListener.java
index f5fa2983a5684d5d5de48b6fcd4e51f58601c749..58daa3d86c8751d3cdbe0f0c66dd08e94d67d0a8 100644
--- a/src/main/java/net/floodlightcontroller/core/IOFMessageListener.java
+++ b/src/main/java/net/floodlightcontroller/core/IOFMessageListener.java
@@ -26,10 +26,6 @@ import org.openflow.protocol.OFType;
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
 public interface IOFMessageListener extends IListener<OFType> {
-    public enum Command {
-        CONTINUE, STOP
-    }
-
   /**
    * This is the method Floodlight uses to call listeners with OpenFlow messages
    * @param sw the OpenFlow switch that sent this message
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index e6ecec4c529b8553fc117a33b19af4760cd98cfb..844289e5e8bb6e0c5fd15f4aced06b9715ee676a 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -51,7 +51,7 @@ import net.floodlightcontroller.core.IFloodlightProviderService;
 import net.floodlightcontroller.core.IHAListener;
 import net.floodlightcontroller.core.IInfoProvider;
 import net.floodlightcontroller.core.IOFMessageListener;
-import net.floodlightcontroller.core.IOFMessageListener.Command;
+import net.floodlightcontroller.core.IListener.Command;
 import net.floodlightcontroller.core.IOFSwitch;
 import net.floodlightcontroller.core.IOFSwitchFilter;
 import net.floodlightcontroller.core.IOFSwitchListener;
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/OFMatchJSONSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/OFMatchJSONSerializer.java
new file mode 100644
index 0000000000000000000000000000000000000000..98048b1a59eb21ff5ad8627a82c73ecf8beb8564
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFMatchJSONSerializer.java
@@ -0,0 +1,91 @@
+/**
+*    Copyright 2011, Big Switch Networks, Inc. 
+*    Originally created by David Erickson, Stanford University
+* 
+*    Licensed under the Apache License, Version 2.0 (the "License"); you may
+*    not use this file except in compliance with the License. You may obtain
+*    a copy of the License at
+*
+*         http://www.apache.org/licenses/LICENSE-2.0
+*
+*    Unless required by applicable law or agreed to in writing, software
+*    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+*    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+*    License for the specific language governing permissions and limitations
+*    under the License.
+**/
+
+package net.floodlightcontroller.core.web.serializers;
+
+import java.io.IOException;
+
+import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.map.JsonSerializer;
+import org.codehaus.jackson.map.SerializerProvider;
+import org.openflow.protocol.OFMatch;
+import org.openflow.util.HexString;
+
+public class OFMatchJSONSerializer extends JsonSerializer<OFMatch> {
+
+    /**
+     * Converts an IP in a 32 bit integer to a dotted-decimal string
+     * @param i The IP address in a 32 bit integer
+     * @return An IP address string in dotted-decimal
+     */
+    private String intToIp(int i) {
+        return ((i >> 24 ) & 0xFF) + "." +
+               ((i >> 16 ) & 0xFF) + "." +
+               ((i >>  8 ) & 0xFF) + "." +
+               ( i        & 0xFF);
+    }
+
+    /**
+     * Performs the serialization of a OFMatch object
+     */
+    @Override
+    public void serialize(OFMatch match, JsonGenerator jGen, 
+                                SerializerProvider serializer) 
+                                throws IOException, JsonProcessingException {
+        jGen.writeStartObject();
+        jGen.writeStringField("dataLayerDestination", 
+                    HexString.toHexString(match.getDataLayerDestination()));
+        jGen.writeStringField("dataLayerSource", 
+                    HexString.toHexString(match.getDataLayerSource()));
+        String dataType = Integer.toHexString(match.getDataLayerType());
+        while (dataType.length() < 4) {
+            dataType = "0".concat(dataType);
+        }
+        jGen.writeStringField("dataLayerType", "0x" + dataType);
+        jGen.writeNumberField("dataLayerVirtualLan", 
+                    match.getDataLayerVirtualLan());
+        jGen.writeNumberField("dataLayerVirtualLanPriorityCodePoint", 
+                    match.getDataLayerVirtualLanPriorityCodePoint());
+        jGen.writeNumberField("inputPort", match.getInputPort());
+        jGen.writeStringField("networkDestination", 
+                    intToIp(match.getNetworkDestination()));
+        jGen.writeNumberField("networkDestinationMaskLen", 
+                    match.getNetworkDestinationMaskLen());
+        jGen.writeNumberField("networkProtocol", match.getNetworkProtocol());
+        jGen.writeStringField("networkSource", 
+                    intToIp(match.getNetworkSource()));
+        jGen.writeNumberField("networkSourceMaskLen", 
+                    match.getNetworkSourceMaskLen());
+        jGen.writeNumberField("networkTypeOfService", 
+                    match.getNetworkTypeOfService());
+        jGen.writeNumberField("transportDestination", 
+                    match.getTransportDestination());
+        jGen.writeNumberField("transportSource", 
+                    match.getTransportSource());
+        jGen.writeNumberField("wildcards", match.getWildcards());
+        jGen.writeEndObject();
+    }
+
+    /**
+     * Tells SimpleModule that we are the serializer for OFMatch
+     */
+    @Override
+    public Class<OFMatch> handledType() {
+        return OFMatch.class;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
index dba40d387a02d19213f67e72d289c23447950168..cb0dbf8122fb3c0d8fb3f4388548c2c486615abd 100755
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
@@ -43,6 +43,7 @@ import net.floodlightcontroller.core.IInfoProvider;
 import net.floodlightcontroller.core.IOFMessageListener;
 import net.floodlightcontroller.core.IOFSwitch;
 import net.floodlightcontroller.core.IFloodlightProviderService.Role;
+import net.floodlightcontroller.core.IListener.Command;
 import net.floodlightcontroller.core.module.FloodlightModuleContext;
 import net.floodlightcontroller.core.module.IFloodlightModule;
 import net.floodlightcontroller.core.module.IFloodlightService;
@@ -54,6 +55,8 @@ import net.floodlightcontroller.devicemanager.IEntityClassifier;
 import net.floodlightcontroller.devicemanager.IDeviceListener;
 import net.floodlightcontroller.devicemanager.SwitchPort;
 import net.floodlightcontroller.devicemanager.web.DeviceRoutable;
+import net.floodlightcontroller.flowcache.IFlowReconcileListener;
+import net.floodlightcontroller.flowcache.OFMatchReconcile;
 import net.floodlightcontroller.packet.ARP;
 import net.floodlightcontroller.packet.DHCP;
 import net.floodlightcontroller.packet.Ethernet;
@@ -68,6 +71,7 @@ import net.floodlightcontroller.util.MultiIterator;
 import static net.floodlightcontroller.devicemanager.internal.
             DeviceManagerImpl.DeviceUpdate.Change.*;
 
+import org.openflow.protocol.OFMatchWithSwDpid;
 import org.openflow.protocol.OFMessage;
 import org.openflow.protocol.OFPacketIn;
 import org.openflow.protocol.OFPhysicalPort;
@@ -84,7 +88,7 @@ import org.slf4j.LoggerFactory;
 public class DeviceManagerImpl implements 
         IDeviceService, IOFMessageListener,
         IStorageSourceListener, IFloodlightModule,
-        IInfoProvider, IHAListener {  
+        IFlowReconcileListener, IInfoProvider, IHAListener {  
     protected static Logger logger = 
         LoggerFactory.getLogger(DeviceManagerImpl.class);
 
@@ -484,7 +488,8 @@ public class DeviceManagerImpl implements
 
     @Override
     public boolean isCallbackOrderingPrereq(OFType type, String name) {
-        return (type == OFType.PACKET_IN && name.equals("topology"));
+        return ((type == OFType.PACKET_IN || type == OFType.FLOW_MOD) 
+        		&& name.equals("topology"));
     }
 
     @Override
@@ -506,6 +511,41 @@ public class DeviceManagerImpl implements
         return Command.CONTINUE;
     }
     
+    // ***************
+    // IFlowReconcileListener
+    // ***************
+    @Override
+    public Command reconcileFlows(ArrayList<OFMatchReconcile> ofmRcList) {
+        for (OFMatchReconcile ofm : ofmRcList) {
+        	// Extract source entity information
+            Entity srcEntity = 
+            	getEntityFromFlowMod(ofm.ofmWithSwDpid, true);
+            if (srcEntity == null)
+                return Command.STOP;
+
+            // Learn/lookup device information
+            Device srcDevice = learnDeviceByEntity(srcEntity);
+            if (srcDevice == null)
+                return Command.STOP;
+
+            // Store the source device in the context
+            fcStore.put(ofm.cntx, CONTEXT_SRC_DEVICE, srcDevice);
+
+            // Find the device matching the destination from the entity
+            // classes of the source.
+            Entity dstEntity = getEntityFromFlowMod(ofm.ofmWithSwDpid, false);
+            logger.debug("DeviceManager dstEntity {}", dstEntity);
+            if (dstEntity != null) {
+                Device dstDevice = 
+                        findDestByEntity(srcDevice, dstEntity);
+                logger.debug("DeviceManager dstDevice {}", dstDevice);
+                if (dstDevice != null)
+                    fcStore.put(ofm.cntx, CONTEXT_DST_DEVICE, dstDevice);
+            }
+        }
+        return Command.CONTINUE;
+    }
+    
     // **********************
     // IStorageSourceListener
     // **********************
@@ -634,42 +674,42 @@ public class DeviceManagerImpl implements
                           Map<String, String> removedControllerNodeIPs) {
         // no-op
     }
-    
+
     // ****************
     // Internal methods
     // ****************
 
     protected Command processPacketInMessage(IOFSwitch sw, OFPacketIn pi, 
                                              FloodlightContext cntx) {
-        Ethernet eth = 
-                IFloodlightProviderService.bcStore.
-                get(cntx,IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
-        
-        // Extract source entity information
-        Entity srcEntity = 
-                getSourceEntityFromPacket(eth, sw, pi.getInPort());
-        if (srcEntity == null)
-            return Command.STOP;
-
-        // Learn/lookup device information
-        Device srcDevice = learnDeviceByEntity(srcEntity);
-        if (srcDevice == null)
-            return Command.STOP;
-
-        // Store the source device in the context
-        fcStore.put(cntx, CONTEXT_SRC_DEVICE, srcDevice);
-
-        // Find the device matching the destination from the entity
-        // classes of the source.
-        Entity dstEntity = getDestEntityFromPacket(eth);
-        if (dstEntity != null) {
-            Device dstDevice = 
-                    findDestByEntity(srcDevice, dstEntity);
-            if (dstDevice != null)
-                fcStore.put(cntx, CONTEXT_DST_DEVICE, dstDevice);
-        }
-
-        return Command.CONTINUE;
+    	Ethernet eth = 
+            IFloodlightProviderService.bcStore.
+            get(cntx,IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
+    
+	    // Extract source entity information
+	    Entity srcEntity = 
+	            getSourceEntityFromPacket(eth, sw.getId(), pi.getInPort());
+	    if (srcEntity == null)
+	        return Command.STOP;
+	
+	    // Learn/lookup device information
+	    Device srcDevice = learnDeviceByEntity(srcEntity);
+	    if (srcDevice == null)
+	        return Command.STOP;
+	
+	    // Store the source device in the context
+	    fcStore.put(cntx, CONTEXT_SRC_DEVICE, srcDevice);
+	
+	    // Find the device matching the destination from the entity
+	    // classes of the source.
+	    Entity dstEntity = getDestEntityFromPacket(eth);
+	    if (dstEntity != null) {
+	        Device dstDevice = 
+	                findDestByEntity(srcDevice, dstEntity);
+	        if (dstDevice != null)
+	            fcStore.put(cntx, CONTEXT_DST_DEVICE, dstDevice);
+	    }
+	
+	    return Command.CONTINUE;
     }
     
     /**
@@ -730,7 +770,7 @@ public class DeviceManagerImpl implements
      * @return the entity from the packet
      */
     private Entity getSourceEntityFromPacket(Ethernet eth, 
-                                             IOFSwitch sw, 
+                                             long swdpid, 
                                              int port) {
         byte[] dlAddrArr = eth.getSourceMACAddress();
         long dlAddr = Ethernet.toLong(dlAddrArr);
@@ -740,7 +780,7 @@ public class DeviceManagerImpl implements
             return null;
 
         boolean learnap = true;
-        if (!isValidAttachmentPoint(sw.getId(), (short)port)) {
+        if (!isValidAttachmentPoint(swdpid, (short)port)) {
             // If this is an internal port or we otherwise don't want
             // to learn on these ports.  In the future, we should
             // handle this case by labeling flows with something that
@@ -755,7 +795,7 @@ public class DeviceManagerImpl implements
         return new Entity(dlAddr,
                           ((vlan >= 0) ? vlan : null),
                           ((nwSrc != 0) ? nwSrc : null),
-                          (learnap ? sw.getId() : null),
+                          (learnap ? swdpid : null),
                           (learnap ? port : null),
                           new Date());
     }
@@ -787,7 +827,48 @@ public class DeviceManagerImpl implements
                           null,
                           null);
     }
+    
+    /**
+     * Parse an entity from an OFMatchWithSwDpid.
+     * @param ofmWithSwDpid
+     * @return the entity from the packet
+     */
+    private Entity getEntityFromFlowMod(OFMatchWithSwDpid ofmWithSwDpid, boolean isSource) {
+    	byte[] dlAddrArr = ofmWithSwDpid.getOfMatch().getDataLayerSource();
+        int nwSrc = ofmWithSwDpid.getOfMatch().getNetworkSource();
+        if (!isSource) {
+        	dlAddrArr = ofmWithSwDpid.getOfMatch().getDataLayerDestination();
+        	nwSrc = ofmWithSwDpid.getOfMatch().getNetworkDestination();
+        }
+        
+        long dlAddr = Ethernet.toLong(dlAddrArr);
+
+        // Ignore broadcast/multicast source
+        if ((dlAddrArr[0] & 0x1) != 0)
+            return null;
+        
+        long swDpid = ofmWithSwDpid.getSwitchDataPathId();
+        short inPort = ofmWithSwDpid.getOfMatch().getInputPort();
 
+        boolean learnap = true;
+        if (!isValidAttachmentPoint(swDpid, inPort)) {
+            // If this is an internal port or we otherwise don't want
+            // to learn on these ports.  In the future, we should
+            // handle this case by labeling flows with something that
+            // will give us the entity class.  For now, we'll do our
+            // best assuming attachment point information isn't used
+            // as a key field.
+            learnap = false;
+        }
+       
+        short vlan = ofmWithSwDpid.getOfMatch().getDataLayerVirtualLan();
+        return new Entity(dlAddr,
+                          ((vlan >= 0) ? vlan : null),
+                          ((nwSrc != 0) ? nwSrc : null),
+                          (learnap ? swDpid : null),
+                          (learnap ? (int)inPort : null),
+                          new Date());
+    }
     /**
      * Look up a {@link Device} based on the provided {@link Entity}.
      * @param entity the entity to search for
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/Entity.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/Entity.java
index 540155e4615e8f8e4c3f06c8acd6c09bcbb05da8..58dfd424c408607f175332d1dede8e0ff0d73281 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/Entity.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/Entity.java
@@ -22,6 +22,7 @@ import java.util.Date;
 import net.floodlightcontroller.core.web.serializers.IPv4Serializer;
 import net.floodlightcontroller.core.web.serializers.MACSerializer;
 import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
+import net.floodlightcontroller.packet.IPv4;
 
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 import org.openflow.util.HexString;
@@ -214,7 +215,7 @@ public class Entity implements Comparable<Entity> {
     public String toString() {
         return "Entity [macAddress=" + HexString.toHexString(macAddress)
                + ", ipv4Address="
-               + ipv4Address + ", vlan=" + vlan + ", switchDPID="
+               + IPv4.fromIPv4Address(ipv4Address==null ? 0 : ipv4Address.intValue()) + ", vlan=" + vlan + ", switchDPID="
                + switchDPID + ", switchPort=" + switchPort + "]";
     }
 
diff --git a/src/main/java/net/floodlightcontroller/flowcache/IFlowReconcileListener.java b/src/main/java/net/floodlightcontroller/flowcache/IFlowReconcileListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..f1100ede0b68b2f584ccb4d04081f4182b01b4c7
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/IFlowReconcileListener.java
@@ -0,0 +1,40 @@
+package net.floodlightcontroller.flowcache;
+
+import java.util.ArrayList;
+
+import net.floodlightcontroller.core.IListener;
+import org.openflow.protocol.OFType;
+
+/**
+ * The Interface IFlowReconciler.
+ *
+ * @author subrata
+ */
+public interface IFlowReconcileListener extends IListener<OFType> {
+    /**
+     * Given an input OFMatch, this method applies the policy of the reconciler
+     * and returns a the same input OFMatch structure modified. Additional
+     * OFMatches, if needed, are returned in OFMatch-list. All the OFMatches
+     * are assumed to have "PERMIT" action.
+     *
+     * @param ofmRcList  input flow matches, to be updated to be consistent with
+     *                   the policies of this reconciler 
+     *                   Additional OFMatch-es can be added to the "list" as
+     *                   needed. 
+     *                   For example after a new ACL application, one flow-match
+     *                   may result in multiple flow-matches
+     *                   The method must also update the ReconcileAction
+     *                   member in ofmRcList entries to indicate if the
+     *                   flow needs to be modified, deleted or left unchanged
+     *                   OR of a new entry is to be added after flow 
+     *                   reconciliation
+     *
+     *
+     * @return   Command.CONTINUE if the OFMatch should be sent to the
+     *           next flow reconciler. 
+     *           Command.STOP if the OFMatch shouldn't be processed
+     *           further. In this case the no reconciled flow-mods would 
+     *           be programmed
+     */
+    public Command reconcileFlows(ArrayList<OFMatchReconcile> ofmRcList);
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/OFMatchReconcile.java b/src/main/java/net/floodlightcontroller/flowcache/OFMatchReconcile.java
new file mode 100644
index 0000000000000000000000000000000000000000..4fee48e1d4e526ea283f64283858c2f79dd3a1fc
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/OFMatchReconcile.java
@@ -0,0 +1,71 @@
+package net.floodlightcontroller.flowcache;
+
+import net.floodlightcontroller.core.FloodlightContext;
+import org.openflow.protocol.OFMatchWithSwDpid;
+
+/**
+ * OFMatchReconcile class to indicate result of a flow-reconciliation.
+ */
+public class OFMatchReconcile  {
+	
+	/**
+	 * The enum ReconcileAction. Specifies the result of reconciliation of a 
+	 * flow.
+	 */
+	public enum ReconcileAction {
+
+	    /** Delete the flow-mod from the switch */
+	    DROP,
+	    /** Leave the flow-mod as-is. */
+	    NO_CHANGE,
+	    /** Program this new flow mod. */
+	    NEW_ENTRY,
+	    /** 
+	     * Reprogram the flow mod as the path of the flow might have changed,
+	     * for example when a host is moved or when a link goes down. */
+	    UPDATE_PATH,
+	    /* Flow is now in a different BVS */
+	    BVS_CHANGED,
+	    /* Delete the flow-mod - used to delete, for example, drop flow-mods
+	     * when the source and destination are in the same BVS after a 
+	     * configuration change */
+	    DELETE
+	}
+	
+    /** The open flow match after reconciliation. */
+    public OFMatchWithSwDpid ofmWithSwDpid;
+    /** flow mod. priority */
+    public short priority;
+    /** Action of this flow-mod PERMIT or DENY */
+    public byte action;
+    /** flow mod. cookie */
+    public long cookie;
+    /** The application instance name. */
+    public String appInstName;
+    /**
+     * The new application instance name. This is null unless the flow
+     * has moved to a different BVS due to BVS config change or device
+     * move to a different switch port etc.*/
+    public String newAppInstName;
+    /** The reconcile action. */
+    public ReconcileAction rcAction;
+
+    // The context for the reconcile action
+    public FloodlightContext cntx;
+    
+    /**
+     * Instantiates a new oF match reconcile object.
+     */
+    public OFMatchReconcile() {
+        ofmWithSwDpid      = new OFMatchWithSwDpid();
+        rcAction = ReconcileAction.NO_CHANGE;
+        cntx = new FloodlightContext();
+    }
+    
+    @Override
+    public String toString() {
+        return "OFMatchReconcile [" + ofmWithSwDpid + " priority=" + priority + " action=" + action + 
+                " cookie=" + cookie + " appInstName=" + appInstName + " newAppInstName=" + newAppInstName + 
+                " ReconcileAction=" + rcAction + "]";
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java b/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
index 92abe576e0df221a8ae7617a81d171dffc652a4d..e8aeeca05b2d50d4bf69a60f6132d8f89e3e923b 100644
--- a/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
+++ b/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
@@ -43,7 +43,6 @@ import net.floodlightcontroller.routing.IRoutingDecision;
 import net.floodlightcontroller.routing.IRoutingService;
 import net.floodlightcontroller.routing.Route;
 import net.floodlightcontroller.topology.ITopologyService;
-import net.floodlightcontroller.topology.TopologyManager;
 
 import org.openflow.protocol.OFFlowMod;
 import org.openflow.protocol.OFMatch;
@@ -78,7 +77,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule {
                                  FloodlightContext cntx,
                                  boolean requestFlowRemovedNotifn) {    
         OFMatch match = new OFMatch();
-        match.loadFromPacket(pi.getPacketData(), pi.getInPort(), sw.getId());
+        match.loadFromPacket(pi.getPacketData(), pi.getInPort());
 
         // Check if we have the location of the destination
         IDevice dstDevice = 
diff --git a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java b/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java
index 60aeaa70d612069a819f7e4b2da6017e60f58f41..d9771468a7b981ad6a798d675e58f4c6bb0c58ef 100644
--- a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java
+++ b/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java
@@ -310,7 +310,7 @@ public class LearningSwitch
     private Command processPacketInMessage(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx) {
         // Read in packet data headers by using OFMatch
         OFMatch match = new OFMatch();
-        match.loadFromPacket(pi.getPacketData(), pi.getInPort(), sw.getId());
+        match.loadFromPacket(pi.getPacketData(), pi.getInPort());
         Long sourceMac = Ethernet.toLong(match.getDataLayerSource());
         Long destMac = Ethernet.toLong(match.getDataLayerDestination());
         Short vlan = match.getDataLayerVirtualLan();
diff --git a/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java b/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
index 44833301cee3ced38080a9c0f7ce57451e90ac84..e207f9b6338a383472a71d62ebbf78dd3f17e202 100644
--- a/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
+++ b/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
@@ -264,8 +264,8 @@ public abstract class ForwardingBase implements
 
         try {
             counterStore.updatePktOutFMCounterStore(sw, fm);
-            if (log.isTraceEnabled()) {
-                log.trace("pushRoute flowmod sw={} inPort={} outPort={}",
+            if (log.isDebugEnabled()) {
+                log.debug("pushRoute flowmod sw={} inPort={} outPort={}",
                       new Object[] { sw, fm.getMatch().getInputPort(), 
                                     ((OFActionOutput)fm.getActions().get(0)).getPort() });
             }
diff --git a/src/main/java/org/openflow/protocol/OFMatch.java b/src/main/java/org/openflow/protocol/OFMatch.java
index b248af258c5fbf30727aa976ecc09e2c437ff6cd..070f3dc8a5f7dda3b80ae168919d09b3629bd583 100644
--- a/src/main/java/org/openflow/protocol/OFMatch.java
+++ b/src/main/java/org/openflow/protocol/OFMatch.java
@@ -96,7 +96,6 @@ public class OFMatch implements Cloneable, Serializable {
 
     protected int wildcards;
     protected short inputPort;
-    protected long  switchDataPathId;
     protected byte[] dataLayerSource;
     protected byte[] dataLayerDestination;
     protected short dataLayerVirtualLan;
@@ -118,6 +117,7 @@ public class OFMatch implements Cloneable, Serializable {
         this.wildcards = OFPFW_ALL;
         this.dataLayerDestination = new byte[6];
         this.dataLayerSource = new byte[6];
+        this.dataLayerVirtualLan = -1;
     }
 
     /**
@@ -266,16 +266,6 @@ public class OFMatch implements Cloneable, Serializable {
         return this;
     }
 
-    public long getSwitchDataPathId() {
-        return this.switchDataPathId;
-    }
-
-    public OFMatch setSwitchDataPathId(long dpid) {
-        this.switchDataPathId = dpid;
-        return this;
-    }
-
-
     /**
      * Get nw_dst
      * 
@@ -455,8 +445,7 @@ public class OFMatch implements Cloneable, Serializable {
      * @param inputPort
      *            the port the packet arrived on
      */
-    public OFMatch loadFromPacket(byte[] packetData, short inputPort, 
-                                                                  long dpid) {
+    public OFMatch loadFromPacket(byte[] packetData, short inputPort) {
         short scratch;
         int transportOffset = 34;
         ByteBuffer packetDataBB = ByteBuffer.wrap(packetData);
@@ -464,7 +453,6 @@ public class OFMatch implements Cloneable, Serializable {
 
         this.wildcards = 0; // all fields have explicit entries
 
-        this.switchDataPathId = dpid;
         this.inputPort = inputPort;
 
         if (inputPort == OFPort.OFPP_ALL.getValue())
diff --git a/src/main/java/org/openflow/protocol/OFMatchWithSwDpid.java b/src/main/java/org/openflow/protocol/OFMatchWithSwDpid.java
new file mode 100644
index 0000000000000000000000000000000000000000..052a6528144a3c15e8d4fa0459c1a685f3ca7aca
--- /dev/null
+++ b/src/main/java/org/openflow/protocol/OFMatchWithSwDpid.java
@@ -0,0 +1,39 @@
+package org.openflow.protocol;
+
+import org.openflow.util.HexString;
+
+public class OFMatchWithSwDpid {
+    protected OFMatch ofMatch;
+    protected long  switchDataPathId;
+
+    public OFMatchWithSwDpid() {
+    	this.ofMatch = new OFMatch();
+    	this.switchDataPathId = 0;
+    }
+    
+    public OFMatchWithSwDpid(OFMatch ofm, long swDpid) {
+    	this.ofMatch = ofm.clone();
+    	this.switchDataPathId = swDpid;
+    }
+    public OFMatch getOfMatch() {
+		return ofMatch;
+	}
+
+	public void setOfMatch(OFMatch ofMatch) {
+		this.ofMatch = ofMatch.clone();
+	}
+
+	public long getSwitchDataPathId() {
+        return this.switchDataPathId;
+    }
+
+    public OFMatchWithSwDpid setSwitchDataPathId(long dpid) {
+        this.switchDataPathId = dpid;
+        return this;
+    }
+    
+    @Override
+    public String toString() {
+        return "OFMatchWithSwDpid [" + HexString.toHexString(switchDataPathId) + ofMatch + "]";
+    }
+}
diff --git a/src/main/java/org/openflow/protocol/serializers/OFMatchJSONSerializer.java b/src/main/java/org/openflow/protocol/serializers/OFMatchJSONSerializer.java
index e6e297fd8df8585b3748d7ca9c65245febd359a9..69312feb5667855d36c3419f2749658b4ef43eee 100644
--- a/src/main/java/org/openflow/protocol/serializers/OFMatchJSONSerializer.java
+++ b/src/main/java/org/openflow/protocol/serializers/OFMatchJSONSerializer.java
@@ -61,8 +61,6 @@ public class OFMatchJSONSerializer extends JsonSerializer<OFMatch> {
                     match.getDataLayerVirtualLan());
         jGen.writeNumberField("dataLayerVirtualLanPriorityCodePoint", 
                     match.getDataLayerVirtualLanPriorityCodePoint());
-        jGen.writeStringField("inputSwitch", 
-                    HexString.toHexString(match.getSwitchDataPathId()));
         jGen.writeNumberField("inputPort", match.getInputPort());
         jGen.writeStringField("networkDestination", 
                     intToIp(match.getNetworkDestination()));
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index 9fe7bfdfd17ea5d583df23701eeb5bdab4e37046..f7ac9d95421553fa0a7812d79ee4c1ee7f6a9c7d 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
@@ -38,7 +38,7 @@ import net.floodlightcontroller.core.IHAListener;
 import net.floodlightcontroller.core.IFloodlightProviderService.Role;
 import net.floodlightcontroller.core.IOFMessageFilterManagerService;
 import net.floodlightcontroller.core.IOFMessageListener;
-import net.floodlightcontroller.core.IOFMessageListener.Command;
+import net.floodlightcontroller.core.IListener.Command;
 import net.floodlightcontroller.core.IOFSwitch;
 import net.floodlightcontroller.core.IOFSwitchListener;
 import net.floodlightcontroller.core.OFMessageFilterManager;
diff --git a/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java b/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java
index e471eeb8565b1a0357ff3c19a37b6c6c9ead361f..aaa9be06c225dd565d7fe469f94c3ea73e274693 100644
--- a/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java
+++ b/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java
@@ -33,7 +33,7 @@ import net.floodlightcontroller.core.IOFMessageListener;
 import net.floodlightcontroller.core.IOFSwitch;
 import net.floodlightcontroller.core.IOFSwitchFilter;
 import net.floodlightcontroller.core.IOFSwitchListener;
-import net.floodlightcontroller.core.IOFMessageListener.Command;
+import net.floodlightcontroller.core.IListener.Command;
 import net.floodlightcontroller.core.module.FloodlightModuleContext;
 import net.floodlightcontroller.core.module.FloodlightModuleException;
 import net.floodlightcontroller.core.module.IFloodlightModule;
diff --git a/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java b/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java
index b07ee2b2bc266963465b59e51cada55692f4b6db..15fef368e8f1e33c7052ca2013ea2476be3ab6b4 100644
--- a/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java
+++ b/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java
@@ -255,7 +255,7 @@ public class ForwardingTest extends FloodlightTestCase {
 
         // Expected Flow-mods
         OFMatch match = new OFMatch();
-        match.loadFromPacket(testPacketSerialized, (short) 1, 1L);
+        match.loadFromPacket(testPacketSerialized, (short) 1);
         OFActionOutput action = new OFActionOutput((short)3, (short)0);
         List<OFAction> actions = new ArrayList<OFAction>();
         actions.add(action);
@@ -333,7 +333,7 @@ public class ForwardingTest extends FloodlightTestCase {
         
         // Expected Flow-mods
         OFMatch match = new OFMatch();
-        match.loadFromPacket(testPacketSerialized, (short) 1, 1L);
+        match.loadFromPacket(testPacketSerialized, (short) 1);
         OFActionOutput action = new OFActionOutput((short)3, (short)0);
         List<OFAction> actions = new ArrayList<OFAction>();
         actions.add(action);
diff --git a/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java b/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java
index 28926c4c0fc6a944744cf20cbc5a17d8a364e236..0272de2dac25cb6f6cd6839522d692f023201ae2 100644
--- a/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java
+++ b/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java
@@ -154,7 +154,6 @@ public class LearningSwitchTest extends FloodlightTestCase {
         // Mock up our expected behavior
         IOFSwitch mockSwitch = createMock(IOFSwitch.class);
         expect(mockSwitch.getStringId()).andReturn("00:11:22:33:44:55:66:77");
-        expect(mockSwitch.getId()).andReturn(1L);
         mockSwitch.write(po, null);
 
         // Start recording the replay on the mocks
@@ -185,7 +184,7 @@ public class LearningSwitchTest extends FloodlightTestCase {
             .setCommand(OFFlowMod.OFPFC_ADD)
             .setIdleTimeout((short) 5)
             .setMatch(new OFMatch()
-                .loadFromPacket(testPacketSerialized, (short) 1, 1L)
+                .loadFromPacket(testPacketSerialized, (short) 1)
                 .setWildcards(OFMatch.OFPFW_NW_PROTO | OFMatch.OFPFW_TP_SRC | OFMatch.OFPFW_TP_DST
                         | OFMatch.OFPFW_NW_TOS))
             .setOutPort(OFPort.OFPP_NONE.getValue())
@@ -200,7 +199,7 @@ public class LearningSwitchTest extends FloodlightTestCase {
             .setCommand(OFFlowMod.OFPFC_ADD)
             .setIdleTimeout((short) 5)
             .setMatch(new OFMatch()
-                .loadFromPacket(testPacketReplySerialized, (short) 2, 1L)
+                .loadFromPacket(testPacketReplySerialized, (short) 2)
                 .setWildcards(OFMatch.OFPFW_NW_PROTO | OFMatch.OFPFW_TP_SRC | OFMatch.OFPFW_TP_DST
                         | OFMatch.OFPFW_NW_TOS))
             .setOutPort(OFPort.OFPP_NONE.getValue())