Changing some if loops around, specifically where some counts could be done once (checking if packets were over the max_data_size, etc) rather than over a couple lines