Added splitPacket and parsePacket functions.