Added batch processing and regularization