added optional emailing