Refactoring the Tree- and Networkmodel (internal stuff only).