Updated to allow for multiple partial matches.

Fixed issue that occurs when multiple partial matches are found.  The logic needs to append the tail to the rewritten stream, when one exists, otherwise it gets removed.

fixes #5
whitespace fixes
Updated to allow for multiple partial matches via @tjchaplin