Externalize path to download data and refactor some code