Cookie handling reworked.