Improve handling of named distances.