Refactor stage 2.