No longer uses code duplication for opening local and remote streams. Also, switched to OkHttp to handle redirects.