Adding error reporting