Refactored DOI download and added tests