misc cleanup to support manual refresh of saved exports

should be no user facing changes.

wait for build
this is all just pulling the content of the loop into a function