Refactoring for method "matches_condition?"