Tweaks to js closures