Improves deferred js handling