Refacto WDT's XHR callback handling