move some .storage functions into document.js