added BuildPacket method