mutating the document seems icky, this is just for template convenience right? set it as another top-level template param.