refactoring of patterns