chenged calculation logic