Refactoring. Showing progress dialog