moved IOStream to own class hierarchy