Refactor application dispatching.