New KNN code -should compile now