Making small improvements to the buildDom method.