Move the cookie code out of the existing HTTP code