Refactor main.dispatch, fix integration