roll-back to sorting logic