Cover all of the new Nearest code paths

Lots of if statements, but there are 6 basic arrangements.  This also
caught a bug, which I fixed in the new implementation.