Fixes #47. We no longer use document.write which should please @fubra-steve