added a factory for batch processing