Refactored CardSearch to handle background tasks