cleaned up the dom logic a bit