Huge performance optimizations