code and file structure refactoring