Refactoring agent