Added the test coverage and functionnality for finding the nearest neighbor