Separated out some responsibilities related to cookie
pushing/popping/etc and made a more robust impl for cookies.