state management refactored, authorization response handling