Add control logic for search functionality