Simplify calculation of average