Better error handling and removing content when search goes wrong