matcher refactoring