Improve module file generation