refactor some cookie stuff