Swap the order of how the XHR objects are created

@callahad or @seanmonstar - could you guys review this?