Client server session management code