(Split from !307)
These are just the code tidying portions of !307, which should not be controversial. No functional differences; no differences in output; just simply cleaner code.