Stage 3 refactor