Refactor stage 1