Fixed sendEmail call and any other errors. Is currently error-free