localstore refactoring