replaced createStateByID method name with stateFactory