State machine added