This is mostly a search and replace exercise (and thus probably correct). (Individual commits deal with kind-of single functions, and their associated tests.)
More complicated changes I have tried to move into separate merge requests.