progress bar nonstop spinning problem solved by putting the process in main thread (which affects the UI changes)