main file rearrangement