Refactoring main modules