sorting by distance on production