Using cookie instead of sessionStorage