added sorting by distance (in places for now)