Rework XMLHttpRequest wrapper