candidate code for stream parser done.  Needs testing