General code cleanup, PEP compliance, and type hinting.
Fixes minor bugs related to email delivery.
Fixes a minor bug that could prevent the correct completion time from being recorded.
Adds the exit code of the process to the notification message, when available.