Updated dual numbers implementation