Refactor tests and rename mailer.