Uncommented error handling code (comment it out to see errors)