localStorage refactor