refactor for modules