Updated methods GenerateScripts() and CleanseScript().