Refactor module loader to its own function.
Reuse modules that have already been loaded.