Added JSON loading of state.