Refactored the code
Added Mailer class