Refactored AUTH, use AJAX in place of XHR