Added some structure and usage of sessionStorage