more refactoring per suggestions