support several input files, rearrange