Tighten up the login/logout flow.