Heavy memory/performance optimizations #3