Adding the cookie setter to the refresh function