Refactored and reorganized. Added mail.js