Adding support for async scripts.
It's missing some cases still, but works well enough for maps.