Add option to check for error codes