Finish nearest.cpp, using closure to seperate two functionalities