refactored to use ipCookie for cookies with expiration