added statemachine.js