Refactoring and abstraction