Adding a bunch of optimizations