Add some error handling code.