Refactoring of datastructures to reduce coupling of Tree.main() and Tree.init()