Refactored Global interface.
Refactored promise resolution.
Use process.nextTick or MutationObserver instead of setTimeout(0), if available.