Lots of optimizations