I changeg c and d from global without testing.  Fixed.
Rename sql related arguments.