Added setRole function and tests