distance obsoleted by distance_loop