Updating cookie logic