Create state-machine.js