Significant increase in sorting performance.

In my testing, a large table that previously took 50 seconds to sort now takes only ~110ms to sort.