When fixing the async dispatcher to work in version 5, it became clear most of dispatcher.py would have to be reimplemented in async_dispatcher.py, because of the way it was structured.
So dispatcher.py was refactored to allow many of the functions to be reused by async_dispatcher.py.
async_dispatcher.py was partially refactored in this PR however it needs more work.
When fixing the async dispatcher to work in version 5, it became clear most of dispatcher.py would have to be reimplemented in async_dispatcher.py, because of the way it was structured.
So dispatcher.py was refactored to allow many of the functions to be reused by async_dispatcher.py.
async_dispatcher.py was partially refactored in this PR however it needs more work.