Rework the upload xhr and a few other tweaks