Adding HTML email, and general code cleanup