Refactor distance calculation