Made it possible to use all sorts of streams instead of only ofstream.
Will make the tests compatible tonight.
Added the option to work with different streams.