Added calculation functions