Modified construction of DOM

Modified construction of DOM within js file.