Able to move the templates back!

By using both the real document and the shimmed ownerDocument, this works again! Much closer to the original version :)