optimize localSotrage while