Added groups + improvements for login/logout