refactor module loader