Changes to extend error-detecting and make error-handling more graceful.