Final version of knn classifier