improved order to handle tasks that send emails properly