modified code according to url contain group id instead of name