Changed global from this to window to get AMD build working again.