Instead of scratch variables, pass an additional variable into the template context
Use partialCached to avoid any perf penalty. TODO: limit the scope I pass to them. I noticed a teeny tiny perf improvement after doing this, probably because now some giant data structures only need to be generated once.