#21 done (progress bar missing). Minor refactoring.