Remove use of document.application