Update rearrange.py