added support for setting initial state