Mediator insertion code
Add documentation