There are still some warnings about making functions in a loop, but
I’ll fix those as a separate pull request because the fixes are more
than typographic errors.
Thus introducing a few functional regressions, but it's going to be
easier to fix things up without the old code knocking around and
getting in the way.