The function pretty much doubled in size for AMD support - I think this justifies extracting a method for that, so it would read something like this pseudocode
```js
  if (inAMDENvironment() amdEnvActionCall();
  else commonJSEnvACtionCall();
```