Added count_condition method