Move appending to insertDomContent function