This series adds some utility procedures previously discussed in !4, but in a new context that should make them easier to review. I've marked !4 as draft so that I can rebase it before pushing.