Finish knn
Fix logic