Update the function to detect if parameters are already set or not, which did not work