Complete structural refactor