output works, numbers almost match excep for some rounding errors