Massive speed optimizations