Update StateMachine.js