Move logic of object tree to own module