Address review comments for gh-4117.

To be squashed after the final review.