General module refactoring