Update KNN implementation