diff --git a/src/python/of10/message.py b/src/python/of10/message.py
index 994e227..889bbdf 100644
--- a/src/python/of10/message.py
+++ b/src/python/of10/message.py
@@ -3603,13 +3603,9 @@
     an ofp_header Python class.
 
     @param binary_string The packet (string) to be parsed
-    @param raw If true, interpret the packet as an L2 packet.  Not
-    yet supported.
-    @return An ofp_header object
+    @return Tuple of (verison, type, length, xid)
 
     """
-    hdr = ofp_header()
-    hdr.unpack(binary_string)
-    return hdr
+    return struct.unpack_from("!BBHL", binary_string)
 
 
diff --git a/src/python/oftest/controller.py b/src/python/oftest/controller.py
index 88e0ffb..f26b2d4 100644
--- a/src/python/oftest/controller.py
+++ b/src/python/oftest/controller.py
@@ -167,6 +167,8 @@
         Currently filters packet in messages
         @return Boolean, True if packet should be dropped
         """
+        # XXX didn't actually check for packet-in...
+        return False
         # Add check for packet in and rate limit
         if self.filter_packet_in:
             # If we were dropping packets, report number dropped
@@ -203,33 +205,28 @@
         # Process each of the OF msgs inside the pkt
         offset = 0
         while offset < len(pkt):
+            if offset + 8 > len(pkt):
+                break
+
             # Parse the header to get type
-            hdr = ofp.message.parse_header(pkt[offset:])
-            if not hdr or hdr.length == 0:
-                self.logger.error("Could not parse header")
-                self.logger.error("pkt len %d." % len(pkt))
-                if hdr:
-                    self.logger.error("hdr len %d." % hdr.length)
-                self.logger.error("%s" % hex_dump_buffer(pkt[:200]))
-                self.shutdown()
-                return
+            hdr_version, hdr_type, hdr_length, hdr_xid = ofp.message.parse_header(pkt[offset:])
 
             # Extract the raw message bytes
-            if (offset + hdr.length) > len(pkt):
+            if (offset + hdr_length) > len(pkt):
                 break
-            rawmsg = pkt[offset : offset + hdr.length]
-            offset += hdr.length
+            rawmsg = pkt[offset : offset + hdr_length]
+            offset += hdr_length
 
-            if self.filter_packet(rawmsg, hdr):
-                continue
+            #if self.filter_packet(rawmsg, hdr):
+            #    continue
 
-            self.logger.debug("Msg in: buf len %d. hdr.type %s. hdr.len %d hdr.version %d hdr.xid %d" %
-                              (len(pkt), ofp.ofp_type_map[hdr.type], hdr.length, hdr.version, hdr.xid))
-            if hdr.version < ofp.OFP_VERSION:
+            self.logger.debug("Msg in: buf len %d. hdr_type %s. hdr_len %d hdr_version %d hdr_xid %d" %
+                              (len(pkt), ofp.ofp_type_map[hdr_type], hdr_length, hdr_version, hdr_xid))
+            if hdr_version < ofp.OFP_VERSION:
                 self.logger.error("Switch only supports up to OpenFlow version %d (OFTest version is %d)",
-                                  hdr.version, ofp.OFP_VERSION)
+                                  hdr_version, ofp.OFP_VERSION)
                 print "Switch only supports up to OpenFlow version %d (OFTest version is %d)" % \
-                    (hdr.version, ofp.OFP_VERSION)
+                    (hdr_version, ofp.OFP_VERSION)
                 self.disconnect()
                 return
 
@@ -242,8 +239,8 @@
             with self.sync:
                 # Check if transaction is waiting
                 with self.xid_cv:
-                    if self.xid and hdr.xid == self.xid:
-                        self.logger.debug("Matched expected XID " + str(hdr.xid))
+                    if self.xid and hdr_xid == self.xid:
+                        self.logger.debug("Matched expected XID " + str(hdr_xid))
                         self.xid_response = (msg, rawmsg)
                         self.xid = None
                         self.xid_cv.notify()
@@ -251,16 +248,16 @@
 
                 # Check if keep alive is set; if so, respond to echo requests
                 if self.keep_alive:
-                    if hdr.type == ofp.OFPT_ECHO_REQUEST:
+                    if hdr_type == ofp.OFPT_ECHO_REQUEST:
                         self.logger.debug("Responding to echo request")
                         rep = ofp.message.echo_reply()
-                        rep.xid = hdr.xid
+                        rep.xid = hdr_xid
                         # Ignoring additional data
                         self.message_send(rep.pack())
                         continue
 
                 # Log error messages
-                if hdr.type == ofp.OFPT_ERROR:
+                if hdr_type == ofp.OFPT_ERROR:
                     if msg.err_type in ofp.ofp_error_type_map:
                         type_str = ofp.ofp_error_type_map[msg.err_type]
                         if msg.err_type == ofp.OFPET_HELLO_FAILED:
@@ -285,18 +282,18 @@
                     else:
                         type_str = "unknown"
                     self.logger.warn("Received error message: xid=%d type=%s (%d) code=%s (%d)",
-                                     hdr.xid, type_str, msg.err_type, code_str, msg.code)
+                                     hdr_xid, type_str, msg.err_type, code_str, msg.code)
 
                 # Now check for message handlers; preference is given to
                 # handlers for a specific packet
                 handled = False
-                if hdr.type in self.handlers.keys():
-                    handled = self.handlers[hdr.type](self, msg, rawmsg)
+                if hdr_type in self.handlers.keys():
+                    handled = self.handlers[hdr_type](self, msg, rawmsg)
                 if not handled and ("all" in self.handlers.keys()):
                     handled = self.handlers["all"](self, msg, rawmsg)
 
                 if not handled: # Not handled, enqueue
-                    self.logger.debug("Enqueuing pkt type " + ofp.ofp_type_map[hdr.type])
+                    self.logger.debug("Enqueuing pkt type " + ofp.ofp_type_map[hdr_type])
                     with self.packets_cv:
                         if len(self.packets) >= self.max_pkts:
                             self.packets.pop(0)
diff --git a/tools/munger/scripts/message_gen.py b/tools/munger/scripts/message_gen.py
index b59c42e..6565bb8 100644
--- a/tools/munger/scripts/message_gen.py
+++ b/tools/munger/scripts/message_gen.py
@@ -961,14 +961,10 @@
     an ofp_header Python class.
 
     @param binary_string The packet (string) to be parsed
-    @param raw If true, interpret the packet as an L2 packet.  Not
-    yet supported.
-    @return An ofp_header object
+    @return Tuple of (verison, type, length, xid)
 
     \"""
-    hdr = ofp_header()
-    hdr.unpack(binary_string)
-    return hdr
+    return struct.unpack_from("!BBHL", binary_string)
 
 """
 
