minor refactor to contain batching-specific logic a bit, and ensure all callbacks are called if batch call fails