Update to the mechanism that enables sorting by distance