Fixed: middleware init now clears results, stream func was being called too many times.
Added: test for failure.
Added: more tests