async script load
rearranged and renamed things, moved callback to top