Changed generate script and minor changes.