refactor IO (again) and provide wrappers for Input/Output streams
fixes #14