implemented nearest(), almost works but not quite...