implemented downloading with following redirects