implementing averages