Finished getNearest implementation, but still untested.