switched over to localStorage from cookies, made code much shorter and nicer