Finish the KNN algorithm