Use document.body and document.head where appropriate. Fix #2.