Added ShellWidget, changed GenerateProgramForFunction() to operate on a given stream.