Move cookie handling to cookie handler