Some fixup

Removed unneeded classes and protocols, tightened code in a few places.