improve the cookie stuff