Extract a method which accepts an own root configuration

There is no changes in the logic. It is just a small refactoring.