[CL 2379638 by Ben Marsh in Main branch]
- Code cleanup and minor rearrangement (e.g. variable name changes). - Additions. - Case issues fixed. - Minor fixes (init ordering). [CL 2172690 by Dmitry Rekman in Main branch]
[CL 2095959 by Gil Gribb in Main branch]