Refactor channel model: pipe events to a central channel keyed by type.

This allows addition of channels and listening for threads to be more maintainable as there is one central event listener thread and UI functions are dispatched based upon the event key. Various logic improvements suggested by kibit.