Optimization: significantly reduces the # of read/write operations to localStorage