Changed generate function to accept argument object, to simplify access to optional arguments.

Changed generate function to accept argument object, to simplify access to optional arguments.