Lots of minor code rearrangements; minor bug-fixes. Inspection now works.