this doesn't seem right, what is `nearest` here?  global var somewhere?