Rearrange output file structure