Refactor math operation