various cleanups and another rework.