Updated to allow for document.body to be null