Added code for AvgAP calculation