added percentage to progressbar, minor refactoring