started working on the min_distance