added confirmation email logic