adding ability to use a custom global mediator

see commit messages for details.

also, the minified version has not been updated.