Modularized for testing, also emailing