Fixes for renderDom() function

Makes renderDom() work properly, and also clear the screen between
successive calls