Refactoring and adaptation