Another attempt at getting the cookie and session data right.