First attempt at sorting rotations