rearranged getmodule to improve concurrency and better error control