Use wfScript() instead of global in a few places