Get rid of tight coupling through globals and DOM elements.