polished login and logout