Various optimizations of template code,
including passing in document and register parameters to buildRendering().
Refs #227.