Merged Kevins xhr changes

Kevin's original pull request is in #86