Code rearrangment