reworked sorting shift() use