Fixes #853879 (Split into multiple PRs, left open for reference)

just opening this to see a diff, so that I can split this up into smaller pieces more easily.