State Machine working.