Split state-machine.js