Wouldn't it be better to calculate the avpkt parameter with an EWMA over time than have it as a parameter? Sometimes it's difficult to guess the average packet size...