outputs to file instead of just stdout