adjusting email logic