Implemented FSM state management