Added login/logout logic