Various optimization enhancements