Added download handling by response code, needs to be tested