Improve auto generation script, overwrites files only when they differ