renamed createStateMachine method to build.