Moved MathUtil to its own file.