Re-designed the event dispatch and receive functionality to use a generic function callback signature.