Packet processing refactored