Added stability and errorchecking for AJAX requests.
Further improved errorhandling.