upd knn algo, allow custom origin