Refactor generateFunctionParameters