Modified code structure to fit AngularJS guidelines. Added HubStatus event