New KNN code -should compile now
function code