Added the ability to direct output to stdout instead of a file.