performance improvements using the DOM API