improvements to differentiation