Fixed knn bug and did some house-cleaning.