don't take a file name, can we take an output stream or the file? Let's loosen the coupling.