CCL: refactor search_term_x into two functions