Refactor registration module.