Refactor agent.js into 4 files with 1 export each.
Refactor batch.js into 2 files with 1 export each.