refactor to download and install only if target dir does not exist yet (prepare for caching)