Added email logic