Improvements and optimizations