Start on knn based solution, refactor functionality