(wip) quick and dirty refactoring of email completion function as a temporary module