Refactor download and setup_dependencies