Added more logging, fixed exception bug with email in main.py