Refactor mirror download code, split it into separate methods. #45 #114