Rearrange the queue