Fixed indentation, moved set_error_handler, and added restore_error_handler.