Added batch processing mode and command line options.