ADD: better error handling for downloads, + some minor improvements/cleanup