Refactoring custom matchers, added some tests.