Modifying setCookies to keep track of old state of cookies