New Xhr Javascript class and some code improvements