email code tweaks