added StateMachine in the Application.c, not tested