Applied IntelliJ suggested refactoring