rearrange source code