Update function KNN