update all classes, no major functional changes, just some cleaning and error checking