changed ave_min_distance function so that business to itself is not considered