BatchWriter refactoring.