Start to tidy the SMTP code