Added debug mode.
Added flask functions to email template.