Refactored dom observables to eliminate common code.