Code optimization

1) Fixed unused and duplicating variables in xhr() arguments
2) Code was minified (unnecessary function and condition were removed)
3) Code style fixes