refactored matcher class to function