cleaned up code and added a loading bar to show the next update. also added error functions to ajax calls and better responses