main module refactoring