Issue #1927238, #1915880 by baldwinlouie: Reworked the mail templates to use Tokens. Refactored the instance_listing and removed a bunch of unused functions