exception handling for bad materials, 'Errors' tab, lots of code cleanup & fixes