updating local storage function