Moved code for download bar to a separate file and refactored it to do as less DOM traversal and manipulation as possible.