Refactoring the downloadFile, first step, issue #25