stage 2 refactoring