refactoring: for batching