Fix up and addition of optional parameters

Renaming of variables and addition of optional parameters