Slow.  Needs some cleanup.
Needs vargs and input file / output file specification from the command line.