refactor localStorage