Create the workflow function