Added document.readyState check to using modules