change to nearestneighbor algo and frontend