Multiroles js refactoring