This needs to be updated as well to handle the namespace instead of just window.