Added handling of authorization.