improved appending html to the dom