Updated percentage calculation logic