Change to calculate averages correctly