Refactor and reorganized the module.