major refactor and reorganization