added d2 from Ecomwise - forked repo