Introduce ReductionTemplate, plus minor fixes.