Added more flexibility to Knn algorithm