rearrange gems