refactoring:
Breaking stream.js to several modules