added authorization and error reporting