Closes #2975 (closed).
This has cherry picks from #2071 (closed), #2534 (closed), #2534 (closed), #2836 (closed) and one manually applied commit.
Closes #2975 (closed).
This has cherry picks from #2071 (closed), #2534 (closed), #2534 (closed), #2836 (closed) and one manually applied commit.