Cleanup: move some methods from util to maths_util.