next refactoring