Better UMD and bug fixes for nested define checks.

Now internally repurposes the known safe identifier `define` to track
the use of external `define`.  This allows us to safely inject into the
global scope allowing nested modules to detect for AMD correctly.  We
then restore the identifier in the end fragment.