More cleanups and simplifications, no functionality change.