Fix MathUtils; make generic.