add some new logic for role determination