Add loading bar and refactoring.