changes to nearest neighbor algo