Refactoring code parts and show loading percentage