more batch refactoring