Corrections and optmizations.
Renamed generate.ph to generate.php