Abstracted connection logic to mediator class.