Added email notifications and fine tuned logging