distance_gen added