Easy Dynamic Dual Wan Failover

My starting point was from here: http://forum.mikrotik.com/t/solved-failover-script-for-2xwan-pppoe-client-and-usb-4g-lte-with-e-mail-notification/99835/1
I modified it to suit my needs and to address issues i discovered during testing.