optimized memory usage even more