Update state-machine.js