Improve collection file generation