Move search logic to Task class