Improve the progress calculation logic