Localization done with factory and DI

Even made tree work again!