refactoring second round