Added XML support and retry on 501