some final reorg, removed more nonfunctional code