Moved the output stream to the save method