More testing

- make dispatcher code more readable
- add tests for dispatching multiple events to a listener, dispatching events to multiple listeners, and ensuring that listeners aren't dispatched events to which they didn't subscribe
- add a new stub for testing