Automated refactoring (single file)