Update stateMachine.js