almost finish login/logout part