adding ability to use a custom global mediator

see commit messages for details