More work on bug #8161.  More template tweaks.