The changes in this batch are all in files under layouts.
This PR modifies code to be a bit more performant and also does some cleanup.
I have mostly done work on low hanging fruit. There are still other ways of improving, but whose involve more deep research in the code and probably more drastic changes in order to be implemented.
OK. I'll leave this for 3.6.4 just to be safe and as we are in RC anyhow. But this looks fine to me. RTC