Updated logging and email tracking logic.