Refactoring and compressing file structure