added function distance_to_goal