Moved all the js out of the global scope, started using ajaxSetup to set the token for all requests