Refactoring to use FloatMath