I should move the email rendering logic out of the main module. Better tests and minor fixes