Rearrange code (#83)