Changed to a 3-NN implementation