Move chunks of DOM construction into their own functions.
DOM creation cleanup