batch process refactoring