Move some functions into a math unit.