Updated to use ChUI Pub/sub for decoupling.

Removed tight coupling between templates by using pub/sub mediators and
broadcast events with data and subscribers that execute when receiving
the broadcast published by the mediators.