findClosest refactoring
some ideas in commentaries