A refactor to pull the weight/merge code into classes in the streams module.

Haven't quite got the balancing right yet...
Fix max_stream_length calculation.  Was setting the instance attribute
rather than the class attribute.