email refactor work