refactored dom_builder