Non functional version with latest changes of knnmatch