added error handling to ajax requests
added minified version of main script