do modify to kNN code