Cleaned up the xhr utility code.