Various cleanup. Reorganized error handling a bit. Made more classes final.