add local storage function