refactoring for code smell