Added code to prevent re-downloading files. Thanks to @mgsk for the code.