Cookies refactoring