Refactor Upload and Download