I made edits to attempt to support stream types

i don't know if the code is completely working, but you can see for yourself.

Edits are highlighted by a /*EDIT: ... */ type comment.  Anywhere ruleMatch = false except in TYPE SPECIFIC cases, we make the new streamMatch false as well.

It looks fairly logical, let me know what you think.