cleanup mathlib code