initial refactor to allow non-chunked download