Sorting by distance

Why the fuck wasn't this already merged.