refactoring setup_roles and updated tests