refactored to use broadcast receivers