Edits to functions.cpp doKNN.