Optimization for less memory usage