Added calculation function and conversion.