Allowing to pass custom class as Root.

The main idea is to allow to create custom methods that can be used when the class is instantiated.