Refactor search_contacts