refactor cookies() method