Added overload of BuildTemplate to take a stream input