Backout of #3513 (except formatting)
Merge pull request #3546 from yurydelendik/backout-3513

Backout of #3513 (except formatting)