Modified logic for the authorization handler