Added calculation logic