Adding controller state machine