improvied login/logout