Change localStorage to sessionStorage and add expiration time to document.cookie