refactor batch job processing