Improvements to state machine. Add discarding of all-zero packets.