Implemented client side logic for keeping the cookie  updated.