while refactoring