now using cookies instead of local storage