Patch 1/2 is a code quality improvement with no functional change, but it helps facilitate the fixes in patch 2/2. Ok for master? Note that I don't yet have write access, so will need help committing this.