Move message dispatching to ui.