State machine working.