Rework kv_pair_quicksort

Signed-off-by: Casey Dahlin <casey.dahlin@gmail.com>