Refactor search_spec