A faster sort implementation that actually, you know, sorts properly.

The other one was giving incorrect results due to how numbers are sorted in the comparison.