Code and file refactoring