Cleaning some mess around xhr creation