Moved the code that is stream-related to its own class.
Added general propose Maybe.