Added progress bar and refactored

Building this list of files has been extracted into a function