refactor PacketReader