changed so you can output to file instead of stdout