clean up cookie handling code in login script