refactored to reduce tight-coupling to Angular
moved subscription logic to controller