refactoring master module