refactor email