Bug 32794: (follow-up) Consolidate shared code into one function (:template)