Merge "Refactor the frontend for batch generation."