Refactor the config module