changed from var to window to resolve amd issues.