A simple knn implementation