refactor module loading