Implemented context thread.
Add handler to context.
Decouple dispatch function.