changed averages and added tests