rearranged document.js methods