Fixed localstorage creation and caching of the messages before creation finished
Refactoring in favor of more storage-ready behavior
Merge with dev branch