updated after review.
(cherry picked from commit 7683348)
updated after review.