Clean up Mathematica derivations