mediator code improvements