Ported the demo code over to work as a unit test and fixed up some
subquery issues with streams.