Refactor for jqXHR