modified a body of average()