Private heap and other optimizations, and some non-optimizations for maintainability