Phase 2 refactor