Added first approach of StateMachine