findnearest optimized ;)