Midway refactoring to show progress dialog while loading data.