Optimizations and performance enhancements