Add some error handling and reporting