Add option to use stdout rather than file