major structural refactor