updated diff formula