added AMD support and exposing to window as a fallback