apply refactoring