refactored js controllers to broadcast and receive