added min_distance like Mike