new batch processing code