major refactor/reorg