Download and cache refactoring