Modified Min_distance Solution