Put kNN classification in an own method