Pattern refactoring