Fixed numerical instability problem--ranker now works in 2D reliably.
bit of cleanup in the code, stop running through so many n-choose-2 loops.