refactored to handle content errors