Refactored backend code to parse email and send email. Testing needed.