Updated document generation script