Move worker code into the process script, to prep for the conversion to plugins.