Added support for text file output.
Simplified input and output, and finished command line "interface".