local storage refactoring #2