Revert to making the loop function shared across template modules.