Adjust various classes to make them more compatible with compiler optimizations. See individual commits.