modified generate script