Extracted from a larger commit by tabbott because these changes will not create significant merge conflicts.