Refactoring MathHelper