allow for passing in initial state and expose state