Clean up. Adding some checks, starting to prepare the email sender