avgDist implemented