Extract DataPacket handling to method.
Extract StatePacket handling to method.