improved login/logout