added mediator test file, re-organized mediator code.