Use stream for lower memory usage