refactor around Cookie struct