Fixed the all-depend-on-one bug in rearrange.
Cleanup