major core reorg and cleanup