added localstorage cache functionality