optimized index access in localstorage