Done rewriting in JS: haven't checked; still use 2-way async export code