Improve various generation-related scripts