added calculation functions