1st version of nearest neighbor