refactoring Cookies.js