yet another stab at sorting