refactoring of math lib to speed up compilation