move dispatch logic into ri