Improve Math helper class and tests.