encapsulate the input/output streams
Merge with master branch