Heavy memory/performance optimizations #2