use template for email and code cleanups