added global flags to control user notification and email sending.