added knn support