implemented data/packet size calculation