rearrange and modified a lot