PE: rewrite batch loop to less cryptic form