Refactor Dropbox downloads and be more careful about thread safety