Refactoring the method "matches_condition?" to decrease the complexity.