Adding progress bar

Refactoring code to make method shorter/cleaner