Clean up login() and logout()