rearranges directories and file paths