Modified streaming example to read templates in chunks