Adding generateScript method.  Recursion not working yet.