Remove debug msg.
Add storeStateHasChanged, and some refactoring.

storeStateHasChanged prevents saving the store with unchanged state.