Updated calculation algorithm