Updated controller for XHR