add cookie swap function