Refactoring and packaging the module