Changes to add ROLE and TYPE and make them work