rename broadcastEvent to dispatchEvent for consistency with DOM events, plus a few other minor tweaks