rearrange method