refactoring for module based structure